微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

圆ci cloudformation模板aws区域错误

如何解决圆ci cloudformation模板aws区域错误

我从教程中使用了以下圆 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

请帮我排除故障。

enter image description here

还尝试像截图一样将环境变量添加到 circleci

enter image description here

解决方法

正如错误消息所暗示的那样。您需要将区域添加到您的配置中:

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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。