5

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.

Andy N
  • 1,013
  • 9
  • 25

2 Answers2

16
sam deploy --guided --profile some_role --region us-west-2
Community
  • 1
  • 1
Andy N
  • 1,013
  • 9
  • 25
7

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" <--------
Hyder B.
  • 10,900
  • 5
  • 51
  • 60