如何将列表传递给 powershell 中的 aws CDK bootstrap `--cloudformation-execution-policies` 参数

How to pass list to aws CDK bootstrap `--cloudformation-execution-policies` parameter in powershell

目标

要在 powershell 中使用 AWS CDK bootstrap 命令,请使用带有列表的 --cloudformation-execution-policies 参数。

documentation 没有 OS 的具体例子。

测试

他们都失败了:

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

环境

问题

CDK 工具在 powershell 中解析列表的正确方式是什么?

参考资料

  • CDK模板CloudFormationExecutionPolicies参数info link
  • CFN模板参数CommaDelimitedList类型info link

回答

关键是CDK使用CFN参数传递值,而且是CommaDelimitedList,传递方式是单个字符串,而不是列表

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