【问题标题】:circle ci cloudformation template aws region errrorcircleci cloudformation模板aws区域错误
【发布时间】:2021-05-24 09:39:11
【问题描述】:

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

但是当我在循环 ci 中执行时,我得到了

You must specify a region. You can also configure your region by running "aws configure".

Exited with code exit status 253

请帮我解决问题。

还尝试将环境变量添加到 circleci 中,如屏幕截图所示

【问题讨论】:

标签: amazon-web-services amazon-cloudformation circleci


【解决方案1】:

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

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

【讨论】:

  • 我已提交:``` aws cloudformation deploy \ --template-file template.yml \ --stack-name my-stack --region eu-central-1 ``` 但我仍然得到 ``` #!/bin/bash -eo pipefail aws cloudformation deploy \ --template-file template.yml \ --stack-name my-stack --region eu-central-1 你必须指定一个区域。您还可以通过运行“aws configure”来配置您的区域。退出代码退出状态 253 CircleCI 收到退出代码 253 ```
  • 补充一下,我在运行提交的 VM 上做了 aws configure,也许我需要在 circleci 中的某个地方设置它?
  • @vprocopan 尝试一行,而不是将命令分成多行:aws cloudformation deploy --template-file template.yml --stack-name my-stack --region eu-central-1
  • 同样,不幸的是
  • @vprocopan 您确定有问题的代码完全代表您的实际代码吗?
猜你喜欢
  • 2016-12-12
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-11-20
  • 2017-01-28
  • 2017-04-05
  • 1970-01-01
  • 2018-08-28
相关资源
最近更新 更多