我正试图用cloudformation服务完成一个代码管道,结果生成了这个错误。必须指出的是,单独的云信息服务运行良好。完整的错误是:
JobFailed需要功能:[CAPABILITY_AUTO_EXPAND](服务:AmazonCloudFormation;状态代码:400;错误代码:CapabilitiesException;请求ID:1a977102-f829-11e8-b5c6-f7cc8454c4d0(
我的解决方案是添加CAPABILITY_AUTO_EXPAND --capabilities
参数,但这只适用于CLI,我的情况是通过web控制台。
遇到同样的问题,我找不到通过控制台解决的方法。但是,它与CLI配合使用效果良好,您可以在此处找到有关管道更新的详细文档:https://docs.aws.amazon.com/cli/latest/reference/codepipeline/update-pipeline.html
我的做法是:
- 制作一个get管道以获取当前管道结构
- 将结果保存为json文件
- 从json文件中:删除元数据部分,在配置部分添加一个具有您的值的capabilities属性
- 使用update pipeline命令和指定上一个json文件的--cli input json选项
示例[注意用箭头标记的更改]:
{
"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
}
}