【问题标题】:aws CAPABILITY_AUTO_EXPAND console web codepipeline with cloudformation具有 cloudformation 的 aws CAPABILITY_AUTO_EXPAND 控制台 Web 代码管道
【发布时间】:2019-05-06 14:28:27
【问题描述】:

我正在尝试使用 cloudformation 服务完成代码管道并生成此错误。必须说,单独的cloudformation服务运行良好。完整的错误是:

作业失败 需要功能:[CAPABILITY_AUTO_EXPAND](服务:AmazonCloudFormation;状态代码:400;错误代码:InsufficientCapabilitiesException;请求 ID:1a977102-f829-11e8-b5c6-f7cc8454c4d0)

我的解决方案是添加 CAPABILITY_AUTO_EXPAND --capabilities 参数,但这仅适用于 CLI,我的情况是通过 Web 控制台。

【问题讨论】:

  • 为了扩展 PJR 的答案,因为我已经看到其他人在其他线程中对此进行格式化,如果您需要指定多个功能,.json 文件中的行应该如下所示:"能力”:“CAPABILITY_IAM,CAPABILITY_AUTO_EXPAND”,
  • 谢谢@PeteFranzen!!!主要帮助。

标签: amazon-web-services amazon-cloudformation amazon-iam aws-codepipeline


【解决方案1】:

示例[注意用箭头标记的更改]:

    {
    "pipeline": {
        "roleArn": "arn:aws:iam::123456789234:role/service-role/AWSCodePipelineServiceRole-us-east-1-SAMpipeline", 
        "stages": [
            {
                "name": "Source", 
                "actions": [
                    {
                        "inputArtifacts": [], 
                        "name": "Source", 
                        "actionTypeId": {
                            "category": "Source", 
                            "owner": "AWS", 
                            "version": "1", 
                            "provider": "CodeCommit"
                        }, 
                        "outputArtifacts": [
                            {
                                "name": "SourceArtifact"
                            }
                        ], 
                        "configuration": {
                            "PollForSourceChanges": "false", 
                            "BranchName": "master", 
                            "RepositoryName": "CFNrepo"
                        }, 
                        "runOrder": 1
                    }
                ]
            }, 
            {
                "name": "Build", 
                "actions": [
                    {
                        "inputArtifacts": [
                            {
                                "name": "SourceArtifact"
                            }
                        ], 
                        "name": "Build", 
                        "actionTypeId": {
                            "category": "Build", 
                            "owner": "AWS", 
                            "version": "1", 
                            "provider": "CodeBuild"
                        }, 
                        "outputArtifacts": [
                            {
                                "name": "BuildArtifact"
                            }
                        ], 
                        "configuration": {
                            "ProjectName": "SAMproject"
                        }, 
                        "runOrder": 1
                    }
                ]
            }, 
            {
                "name": "Deploy", 
                "actions": [
                    {
                        "inputArtifacts": [
                            {
                                "name": "BuildArtifact"
                            }
                        ], 
                        "name": "DeployStack", 
                        "actionTypeId": {
                            "category": "Deploy", 
                            "owner": "AWS", 
                            "version": "1", 
                            "provider": "CloudFormation"
                        }, 
                        "outputArtifacts": [], 
                        "configuration": {
                            "StackName": "s5765722591-cp", 
                            "ActionMode": "CREATE_UPDATE", 
                            "RoleArn": "arn:aws:iam::298320596430:role/CloudFormationFullAccess", 
                            "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND",   <--------------
                            "TemplatePath": "BuildArtifact::template.yaml"
                        }, 
                        "runOrder": 1
                    }, 
                    {
                        "inputArtifacts": [
                            {
                                "name": "BuildArtifact"
                            }
                        ], 
                        "name": "DeployStack2", 
                        "actionTypeId": {
                            "category": "Deploy", 
                            "owner": "AWS", 
                            "version": "1", 
                            "provider": "CloudFormation"
                        }, 
                        "outputArtifacts": [], 
                        "configuration": {
                            "StackName": "s5765722591-cp2", 
                            "ActionMode": "CREATE_UPDATE", 
                            "RoleArn": "arn:aws:iam::123456789234:role/CloudFormationFullAccess", 
                            "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND",    <-----------
                            "TemplatePath": "BuildArtifact::template.yaml"
                        }, 
                        "runOrder": 1
                    }
                ]
            }
        ], 
        "artifactStore": {
            "type": "S3", 
            "location": "codepipeline-us-east-1-123456789234"
        }, 
        "name": "SAMpipeline", 
        "version": 5
    }
 }

【讨论】:

    【解决方案2】:

    遇到了同样的问题,我找不到通过控制台解决的方法。 但是它与 CLI 配合得很好,您可以在此处找到有关管道更新的详细文档:https://docs.aws.amazon.com/cli/latest/reference/codepipeline/update-pipeline.html

    我的做法是:

    1. 制作一个get-pipeline来获取当前的管道结构
    2. 将结果保存为 json 文件
    3. 从 json 文件中:删除元数据部分,在配置部分添加具有您的值的功能属性
    4. 使用带有 --cli-input-json 选项的 update-pipeline 命令指定上一个 json 文件

    【讨论】:

    • 这对我有用...json中的相关行最终像"Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND"。请注意功能之间没有空格,这是必不可少的
    猜你喜欢
    • 2021-02-23
    • 2020-03-08
    • 1970-01-01
    • 2021-06-01
    • 2019-03-08
    • 2022-11-03
    • 1970-01-01
    • 2017-05-28
    • 2021-10-18
    相关资源
    最近更新 更多