aws CAPABILITY_AUTO_EXPAND console web codepipeline with cloudformation

喜夏-厌秋 提交于 2019-12-06 02:10:26

问题


I am trying to complete a codepipeline with the cloudformation service and this error is generated. It must be said that the separate cloudformation service works well. The complete error is:

JobFailed Requires capabilities: [CAPABILITY_AUTO_EXPAND] (Service: AmazonCloudFormation; Status Code: 400; Error Code: InsufficientCapabilitiesException; Request ID: 1a977102-f829-11e8-b5c6-f7cc8454c4d0)

The solutions I have is to add the CAPABILITY_AUTO_EXPAND --capabilities parameter but that only applies to CLI and my case is by web console.


回答1:


Ran into the same problem, I could not find a way to do it through the console. However it works well with the CLI and you can find detailed documentation on pipeline update here : https://docs.aws.amazon.com/cli/latest/reference/codepipeline/update-pipeline.html

The way I did it was :

  1. make a get-pipeline to get the current pipeline structure
  2. save the result as a json file
  3. from the json file : remove the metadata section, add a capabilities attribute with your value in configuration section
  4. use the update-pipeline command with --cli-input-json option specifying the previous json file



回答2:


Sample [Note the changes marked with arrows]:

    {
    "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
    }
 }


来源:https://stackoverflow.com/questions/53625196/aws-capability-auto-expand-console-web-codepipeline-with-cloudformation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!