我不知道如何通过 UI 执行此操作,但在 CloudFormation 中,您可以在“功能”节点的模板中指定它,请参阅下面的“功能”。
以下只是一个片段,并不是 CloudFormation 的格式正确的 JSON。
"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"
},