![](/img/trans.png)
[英]AWS CodePipeline: How to pass output from CloudFormation action to a CodeBuild action
[英]AWS CodePipeline: Get CloudFormation outputs in CodeBuild
我正在學習使用AWS CodePipeline(Cloudformation和CodeBuild)的一些DevOps技術。
我的(簡化的)管道是這樣的:
目前,CloudFormation輸出以下內容:
Outputs:
RestApiId:
Value: !Ref ApiGateway
Description: 'API Id'
問題:如何在CloudBuild中獲取ApiGateway ID?
根據: https : //docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/continuous-delivery-codepipeline-parameter-override-functions.html
您可以這樣指定CodePipeline步驟(來自文檔):
- Name: CreateTestStackA
Actions:
- Name: CloudFormationCreate
ActionTypeId:
Category: Deploy
Owner: AWS
Provider: CloudFormation
Version: '1'
Configuration:
ActionMode: CREATE_UPDATE
Capabilities: CAPABILITY_IAM
OutputFileName: TestOutput.json
RoleArn: !GetAtt [CFNRole, Arn]
StackName: StackA
TemplateConfiguration: TemplateSource::test-configuration.json
TemplatePath: TemplateSource::teststackA.yaml
InputArtifacts:
- Name: TemplateSourceA
OutputArtifacts:
- Name: StackAOutput
RunOrder: '1'
因此,在Configuration
您需要添加OutputFileName
參數並指定輸出工件名稱。 然后,您可以將該工件用作CodeBuild的輸入。 在輸出文件(TestOutput.json)中,您將有一個字典,其中的鍵是輸出名稱,值是輸出值。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.