[英]Importing AWS information from CloudFormation to CodeBuild
我在AWS中擁有Codestar,CodeBuild,CloudFormation等管道。
我試圖弄清楚如何從CloudFormation步驟返回CodeBuild步驟中獲取信息。 讓我分解一下:
我有一個buildspec.yml
為CodeBuild
# buildspec.yml ... phases: ... build: commands: - aws cloudformation package --region $REGION --template template.yml --s3-bucket $S3_BUCKET --output-template $OUTPUT_TEMPLATE
上面使用我們的template.yml
啟動了CloudFormation構建
# template.yml ... S3BucketAssets: Type: AWS::S3::Bucket ...
此時,它為S3存儲桶創建了唯一的名稱。 真棒。 現在,對於我在buildspec.yml
的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模板中,您可以使用!GetAtt [ClientWebAssets, WebsiteURL]
類的名稱引用S3存儲桶名稱。 但是,我不知道如何從cloudformation模板中獲取該信息並返回到代碼構建模板中。
您可以轉到使用CodePipeline。 第一階段是通過cloudformation部署應用程序,輸出工件是堆棧創建輸出
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.