【发布时间】:2022-11-15 12:10:48
【问题描述】:
我正在尝试将 cloudformation 堆栈部署到跨帐户帐户中。但是,当我部署 cloudfromation.yml 文件时,出现以下错误。我什至尝试过使用 cloudformation.yaml 但同样的错误
Waiting for changeset to be created..
Failed to create the changeset: Waiter ChangeSetCreateComplete failed: Waiter encountered a terminal failure state:
For expression "Status" we matched expected path: "FAILED" Status: FAILED. Reason: Transform AWS::Serverless-2016-10-31 failed with: Invalid Serverless Application Specification document. Number of errors found: 1. Resource with id [helloworldpython3] is invalid. 'CodeUri' is not a valid S3 Uri of the form 's3://bucket/key' with optional versionId query parameter.
这是我得到的 cloudformation.yml 文件,它正在部署一个简单的 lambda 函数。我什至尝试过使用 cloudformation.yaml 但我得到了同样的错误
AWSTemplateFormatVersion: "2010-09-09"
Transform: "AWS::Serverless-2016-10-31"
Description: A starter AWS Lambda function.
Resources:
helloworldpython3:
Type: "AWS::Serverless::Function"
Properties:
Handler: lambda_function.lambda_handler
Runtime: python3.6
CodeUri: ./lambda
Description: 'Lambda function for CD Demo'
MemorySize: 128
Timeout: 30
这是我已经设置好的 buildspec.yml 文件
version: 0.2
phases:
install:
commands:
- echo $CROSS_ACCOUNT_ROLE
- echo $TARGET_ACCOUNT_ID
- cd $CODEBUILD_SRC_DIR
- chmod +x cross-account-setup.sh
build:
commands:
- echo "Start Deploy"
- cd $CODEBUILD_SRC_DIR
- . ./cross-account-setup.sh
- >
aws cloudformation deploy --stack-name amr-manual-deployment-cicd --template-file cloudformation-stack.yml --no-fail-on-empty-changeset
- echo "End Deploy"
为了成功部署云形成堆栈,我需要在 .yml 文件中进行哪些更改。
谢谢
【问题讨论】:
标签: amazon-web-services amazon-cloudformation aws-codepipeline aws-codebuild aws-sam