Home > Net >  how to pass a service role to my stack when using CDK?
how to pass a service role to my stack when using CDK?

Time:10-26

When using CloudFormation to deploy AWS resources you can assign a service role to the stack

aws cloudformation create-stack \
  --stack-name ${STACK_NAME} \
  --template-body file://stack.yaml \
  --role-arn ${SERVICE_ROLE_ARN}

How can you do the same thing when using CDK? I see that the StackProps construct does not have a role-arn attribute.

CodePudding user response:

  -r, --role-arn            ARN of Role to use when invoking CloudFormation

as found here: https://docs.aws.amazon.com/cdk/latest/guide/cli.html

however. Ermiya is correct in the comments to your answer, that anything beyond a deployment time role for deployment requires the language you are using - Its slightly, but importantly different in each one. Plus, there are many other factors in CDK deployment that are not part of the CloudFormation Create Stack options, such as AWS Environment (region and account number) and more.

  • Related