【问题标题】:InsufficientCapabilitiesException [CAPABILITY_NAMED_IAM] when creating a stack with IAM policies使用 IAM 策略创建堆栈时出现 InsufficientCapabilitiesException [CAPABILITY_NAMED_IAM]
【发布时间】:2018-08-25 07:01:56
【问题描述】:

我在为包含 IAM 策略的 cloudformation 模板运行 create-stack 时收到此错误。

aws cloudformation create-stack --stack-name iam-stack --template-body file://./iam.yml --capabilities CAPABILITY_IAM --profile dev

调用 CreateStack 操作时发生错误 (InsufficientCapabilitiesException):需要功能:[CAPABILITY_NAMED_IAM]

【问题讨论】:

标签: amazon-web-services amazon-cloudformation


【解决方案1】:

--capabilities 更改为CAPABILITY_NAMED_IAM

如果您有自定义名称的 IAM 资源,则必须指定 CAPABILITY_NAMED_IAM。如果不指定这个参数,这个动作 返回 InsufficientCapabilities 错误。

https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_CreateStack.html

【讨论】:

    【解决方案2】:

    根据 AWS 文档, 如果您在云形成中指定角色名称,则必须指定 CAPABILITY_NAMED_IAM 值以确认模板的功能 Link

    所以你的命令应该是

    aws cloudformation create-stack --stack-name iam-stack --template-body file://./iam.yml --capabilities CAPABILITY_NAMED_IAM --profile dev
    

    【讨论】:

      【解决方案3】:

      对于“AWS::IAM::Role”类型的资源,我需要 CAPABILITY_IAMCAPABILITY_NAMED_IAM 两种功能。

      https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/CloudFormation.html#createStack-property

      【讨论】:

        【解决方案4】:

        如果您使用 AWS CodePipeline 通过 CloudFormation 堆栈部署 EC2,则有一个名为“Capabilities”的选项,您可以从中选择 CAPABILITY_NAMED_IAM。

        【讨论】:

          猜你喜欢
          • 2021-05-13
          • 2017-11-02
          • 2021-10-12
          • 1970-01-01
          • 2018-04-13
          • 2018-02-28
          • 2012-05-18
          • 2021-10-16
          • 2020-12-16
          相关资源
          最近更新 更多