https://pulumi.com logo
Title
n

numerous-printer-41511

11/19/2021, 5:02 PM
is the only way to specify default credentials for the AWS provider to use env vars or
.aws/credentials
?
m

millions-furniture-75402

11/19/2021, 6:47 PM
Here's an example of an AWS_ACCESS_KEY_ID not existing in the environment and using a profile that's been defined in the Pulumi Stack config YAML
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const awsConfig = new pulumi.Config("aws");

if (!process.env.AWS_ACCESS_KEY_ID) {
  aws.sdk.config.credentials = new aws.sdk.SharedIniFileCredentials({ profile: awsConfig.get("profile") });
}