我正在尝试从CodeCommit存储库创建一个cloudformation堆栈。我在CodeBuild中创建了构建项目。
我的Build Command是这样的:
build:
commands:
- aws cloudformation create-stack
--stack-name SGStack
--template-body file://security_groups.template
--parameters ParameterKey=VPCID,ParameterValue=vpc-77092d1
我想我的'--template-body'命令有问题。
如何在codebuild构建命令中引用codecommit repo的文件?
在您的buildspec中,尝试使用pwd或使用CODEBUILD_SRC_DIR环境变量访问模板:
e.g:
build:命令: - aws cloudformation create-stack --stack-name SGStack --template-body file:// $(pwd)/security_groups.template --parameters ParameterKey = VPCID,ParameterValue = vpc-77092d1