我在AWS管道與Codestar,CodeBuild,CloudFormation等AWS導入信息從CloudFormation到CodeBuild
我試圖找出如何從返回CodeBuild步驟CloudFormation步驟的信息。讓我把它分解:
我用我們的
template.yml
# template.yml ... S3BucketAssets: Type: AWS::S3::Bucket ...
在這一點上有過一個CloudFormation構建一個
buildspec.yml
爲CodeBuild# buildspec.yml ... phases: ... build: commands: - aws cloudformation package --region $REGION --template template.yml --s3-bucket $S3_BUCKET --output-template $OUTPUT_TEMPLATE
上面踢,它爲S3存儲桶創建唯一的名稱。真棒。現在,對於CodeBuild的
buildspec.yml
中的步驟2,我想將項目推送到剛剛在CloudFormation模板中創建的S3存儲桶。但是,我不知道如何從CloudFormation模板中獲取動態創建的S3存儲桶的名稱。我想類似的東西:# buildspec.yml ... phases: ... build: commands: # this is the same step as shown above - aws cloudformation package --region $REGION --template template.yml --s3-bucket $S3_BUCKET --output-template $OUTPUT_TEMPLATE # this is the new step - aws s3 sync dist_files/ s3://{NAME_OF_THE_NEW_S3_BUCKET}
如何可以完成獲取動態命名的S3存儲,這樣我可以推到了嗎?
我知道,在CloudFormation模板中,您可以引用S3存儲桶名稱,如!GetAtt [ClientWebAssets, WebsiteURL]
。但是,我不知道如何將這些信息從cloudformation模板中提取出來並返回到codebuild模板中。