Reputation: 21
I've just started with the AWS CI/CD pipeline. I want to make a simple pipeline to deploy a lambda function (and later a api gateway):
Commit in CodeCommit -> Prepare CloudFormation package in CodeBuild -> Deploy to CloudFormation
CodeCommit and CodeBuild works pretty fine but in the Deploy Stage (in CodePipeline) I always get this error:
But in the UI I can't select CAPABILITY_AUTO_EXPAND, only CAPABILITY_IAM and that doesn't fix the problem:
If I do the deployment over CLI I think I can set the CAPABILITY_AUTO_EXPAND option, but I want to do that over the UI.
What can I do?
SAM Template yaml:
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: Returns the body
Resources:
TestFunction:
Type: AWS::Serverless::Function
Properties:
Handler: test.handler
Runtime: nodejs8.11.0
CodeUri: ./
Events:
TestAPI:
Type: Api
Properties:
Path: /test
Method: POST
Upvotes: 1
Views: 967
Reputation: 21
I (kind of) solved my issue with the answer in this thread: aws CAPABILITY_AUTO_EXPAND console web codepipeline with cloudformation
Looks like the AWS UI jsut don't displays the option and you need to update the pipeline over the AWS cli.
Upvotes: 0
Reputation: 1178
I don't know how to do it thru the UI but in CloudFormation, you would specify it in template at the "Capabilities" node, see "Capabilities" below.
The below is only a snippet and is not well-formed JSON for CloudFormation.
"Resources": {
"Pipeline": {
"Type": "AWS::CodePipeline::Pipeline",
"Properties": {
"ArtifactStore": {
"Location": {
"Fn::Join": [
"-",
[
"bubbleboy",
{
"Ref": "AWS::AccountId"
}
]
]
},
"Type": "S3"
},
"Name": {
"Ref": "AWS::StackName"
},
"RoleArn": {
"Fn::GetAtt": [
"PipelineRole",
"Arn"
]
},
"Stages": [
{
"Actions": [
{
"ActionTypeId": {
"Category": "Source",
"Owner": "AWS",
"Provider": "CodeCommit",
"Version": "1"
},
"Configuration": {
"RepositoryName": {
"Ref": "Repo"
},
"BranchName": {
"Ref": "Branch"
}
},
"Name": "Source",
"RunOrder": "1",
"OutputArtifacts": [
{
"Name": "Source-Artifact"
}
]
}
],
"Name": "SourceCode"
},
{
"Actions": [
{
"ActionTypeId": {
"Category": "Build",
"Owner": "AWS",
"Provider": "CodeBuild",
"Version": "1"
},
"Configuration": {
"ProjectName": {
"Ref": "CodeBuildStage1NetCoreCodeBuildProject1"
}
},
"Name": "Build",
"RunOrder": "1",
"OutputArtifacts": [
{
"Name": "Build-Artifact"
}
],
"InputArtifacts": [
{
"Name": "Source-Artifact"
}
]
}
],
"Name": "Build"
},
{
"Actions": [
{
"ActionTypeId": {
"Category": "Deploy",
"Owner": "AWS",
"Provider": "CloudFormation",
"Version": "1"
},
"Configuration": {
"ActionMode": "CHANGE_SET_REPLACE",
"StackName": {
"Fn::Join": [
"-",
[
{
"Ref": "AWS::StackName"
},
"deploy"
]
]
},
"Capabilities": "CAPABILITY_IAM",
"RoleArn": {
"Fn::GetAtt": [
"CreateChangesetCloudFormationRole1",
"Arn"
]
},
"ChangeSetName": {
"Ref": "AWS::StackName"
},
"TemplatePath": "Build-Artifact::Deploy.template",
"ParameterOverrides": {
"Fn::Join": [
"",
[
"{ \"YadaYadaBubbleBoyWebApiBucket\": { \"Fn::GetArtifactAtt\": [ \"Build-Artifact\", \"BucketName\" ] }, \"YadaYadaBubbleBoyWebApiKey\": { \"Fn::GetArtifactAtt\": [ \"Build-Artifact\", \"ObjectKey\" ] },\"DbBranch\":\"",
{
"Fn::If": [
"isstaging",
"master",
{
"Ref": "Branch"
}
]
},
"\"}\"DatabaseStack\":\"",
{
"Fn::If": [
"isstaging",
"database-stage",
{
"Ref": "DatabaseStack"
}
]
},
"\"}"
]
]
}
},
"Name": "CreateChangeset",
"RunOrder": "1",
"InputArtifacts": [
{
"Name": "Build-Artifact"
}
]
},
{
"ActionTypeId": {
"Category": "Deploy",
"Owner": "AWS",
"Provider": "CloudFormation",
"Version": "1"
},
"Configuration": {
"ActionMode": "CHANGE_SET_EXECUTE",
"StackName": {
"Fn::Join": [
"-",
[
{
"Ref": "AWS::StackName"
},
"deploy"
]
]
},
"Capabilities": "CAPABILITY_IAM",
"RoleArn": {
"Fn::GetAtt": [
"ExecuteChangesetCloudFormationRole1",
"Arn"
]
},
"ChangeSetName": {
"Ref": "AWS::StackName"
}
},
"Name": "ExecuteChangeset",
"RunOrder": "2"
}
],
"Name": "Deploy"
}
]
},
"DeletionPolicy": "Delete"
},
Upvotes: 0