Andy N
Andy N

Reputation: 1123

How do you make AWS SAM deploy use aws profile?

I need to have SAM deploy use a specific aws config profile. Where do you set that? This aws profile assumes a role needed for deploying.

Upvotes: 8

Views: 8890

Answers (2)

Hyder B.
Hyder B.

Reputation: 12186

I encountered the same issue while dealing with multiple AWS CLI profiles. You first need to build the project with the following:

sam build --profile <name>

And then deploy with the following parameters:

sam deploy --profile <name> --guided

You will also notice that it will automatically add the custom profile inside the autogenerated samconfig.toml so that next time you don't need to specify the --profile flag when running sam deploy

version = 0.1
[default]
[default.deploy]
[default.deploy.parameters]
stack_name = "XXX"
s3_bucket = "XXX"
s3_prefix = "lb-api"
region = "us-east-1"
capabilities = "CAPABILITY_IAM"
parameter_overrides = "Stage=\"Staging\""
image_repositories = []
profile = "XX" <--------

Upvotes: 12

Andy N
Andy N

Reputation: 1123

sam deploy --guided --profile some_role --region us-west-2

Upvotes: 22

Related Questions