aws-sam-cli icon indicating copy to clipboard operation
aws-sam-cli copied to clipboard

Bootstrap doesn't support --role_arn

Open jplock opened this issue 5 years ago • 6 comments

Description

Running sam deploy --guided the first time to create the S3 bucket via a CloudFormation template, the --role_arn parameter isn't supported in https://github.com/awslabs/aws-sam-cli/blob/master/samcli/lib/bootstrap/bootstrap.py

Steps to reproduce

Run sam deploy --guided and it fails because we have policies that require all CloudFormation stacks to use a specific role.

Observed result

Please provide command output with --debug flag set.

Expected result

I'm able to run sam deploy --guided --role_arn <my_role_arn> and SAM will provision it's CloudFormation stack with the role I specified.

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

  1. OS: Mac
  2. sam --version: SAM CLI, version 0.47.0

Would you accept a pull request adding this?

jplock avatar Apr 13 '20 20:04 jplock

sam deploy does support --role-arn

https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-cli-command-reference-sam-deploy.html

sriram-mv avatar Apr 27 '20 18:04 sriram-mv

@sriram-mv correct, but if it needs to bootstrap the S3 bucket, the role_arn does not get used.

jplock avatar Apr 27 '20 19:04 jplock

Makes sense, in the meantime a workaround is setup the role_arn in a aws profile and pass in that profile during guided.

sam deploy -g --profile role_profile

sriram-mv avatar Apr 29 '20 16:04 sriram-mv

@sriram-mv the CloudFormation role we are using isn't assume-able by users, it's a service role, so I don't think what you proposed would work

jplock avatar Apr 29 '20 17:04 jplock

@jplock Makes sense. Thanks for clarifying.

sriram-mv avatar May 06 '20 17:05 sriram-mv

@sriram-mv thoughts on including https://github.com/awslabs/aws-sam-cli/pull/1933 in an upcoming release? It would simplify our getting started activities

jplock avatar May 12 '20 19:05 jplock