问题描述
我从教程中使用了以下圆 ci 模板。
jobs:
create_infrastructure:
docker:
- image: amazon/aws-cli
steps:
- checkout
- run:
name: Ensure backend infrastructure exist
command: |
aws cloudformation deploy \
--template-file template.yml \
--stack-name my-stack
workflows:
my_workflow:
jobs:
- create_infrastructure
但是当我在循环中执行时,我得到
You must specify a region. You can also configure your region by running "aws configure".
Exited with code exit status 253
还尝试像截图一样将环境变量添加到 circleci
解决方法
正如错误消息所暗示的那样。您需要将区域添加到您的配置中:
jobs:
create_infrastructure:
docker:
- image: amazon/aws-cli
steps:
- checkout
- run:
name: Ensure backend infrastructure exist
command: |
aws cloudformation deploy \
--template-file template.yml \
--stack-name my-stack \
--region <your-region,e.g. us-east-1>
workflows:
my_workflow:
jobs:
- create_infrastructure
更新
在一行中使用命令而不是在多行中使用是解决方案:
aws cloudformation deploy --template-file template.yml --stack-name my-stack --region eu-central-1