1

Goal

To use AWS CDK bootstrap command in powershell, using the --cloudformation-execution-policies argument with a list.

The documentation does not have specific examples for OSs.

Tests

  • Passing a single string worked fine, eg: --cloudformation-execution-policies "arn:aws:iam::aws:policy/AWSLambda_FullAccess"
  • Passing a list of strings in various ways does not work
  • --cloudformation-execution-policies "arn:aws:iam::aws:policy/AWSLambda_FullAccess","arn:aws:iam::aws:policy/AWSCodeDeployFullAccess"
  • --cloudformation-execution-policies "arn:aws:iam::aws:policy/AWSLambda_FullAccess" "arn:aws:iam::aws:policy/AWSCodeDeployFullAccess"
  • --cloudformation-execution-policies @("arn:aws:iam::aws:policy/AWSLambda_FullAccess","arn:aws:iam::aws:policy/AWSCodeDeployFullAccess")
  • --cloudformation-execution-policies @('arn:aws:iam::aws:policy/AWSLambda_FullAccess','arn:aws:iam::aws:policy/AWSCodeDeployFullAccess')

They all fail with:

 ARN arn:aws:iam::aws:policy/AWSLambda_FullAccess arn:aws:iam::aws:policy/AWSCodeDeployFullAccess is not valid.
Status Code: 400; Error Code: InvalidInput;

Environment

  • OS:
  • Python: Python 3.9.5
  • AWS CLI: aws-cli/2.2.5 Python/3.8.8 Windows/10 exe/AMD64 prompt/off
  • Node: v13.14.0
  • CDK: 1.116.0 (build d04661d)

Question

Which is the correct way CDK tool parses lists in powershell?

Efren
  • 4,003
  • 4
  • 33
  • 75
  • Doc update [merged](https://github.com/awsdocs/aws-cdk-guide/pull/351), hopefully it gets released soon! – Efren Aug 05 '21 at 23:33

1 Answers1

3

References

  • CDK template CloudFormationExecutionPolicies parameter info link
  • CFN template Parameter CommaDelimitedList type info link

Answer

The key is that CDK uses a CFN parameter to pass the value, and being a CommaDelimitedList, the way to pass it is as a single string, rather than a list

ie: --cloudformation-execution-policies 'arn:aws:iam::aws:policy/AWSLambda_FullAccess,arn:aws:iam::aws:policy/AWSCodeDeployFullAccess'

Efren
  • 4,003
  • 4
  • 33
  • 75