vprocopan
vprocopan

Reputation: 63

circle ci cloudformation template aws region errror

I have the following circle ci template that I use from a tutorial.


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

But when I execute in in circle ci, I get

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

Exited with code exit status 253

Please help me troubleshoot. enter image description here

Also tried adding the env vars to circleci like in the screenshot enter image description here

Upvotes: 2

Views: 301

Answers (1)

Marcin
Marcin

Reputation: 238967

As the error message suggests. You need to add region to your config:

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

Update

Using the command in one line, as opposed multi-line, was the solution:

aws cloudformation deploy --template-file template.yml --stack-name my-stack --region eu-central-1

Upvotes: 1

Related Questions