Copilot-cli: Bug: copilot CLI fails if no default region found in profile

Created on 10 Jul 2020  Â·  4Comments  Â·  Source: aws/copilot-cli

I am trying to set up copilot init demo app using the interactive CLI but I am unable as the default AWS profile does not have region specified (an optional field) so the init command fails.

hamidrasool@LAPTOP:~/copilot-demo-app$ copilot init
Note: It's best to run this command in the root of your Git repository.
Welcome to the Copilot CLI! We're going to walk you through some questions
to help you get set up with an application on ECS. An application is a collection of
containerized services that operate together.

Application name: copilot-demo
✘ get application copilot-demo: get application copilot-demo: MissingRegion: could not find region configuration

The missing feature in this case is a setting for --region parameter and optionally adding a prompt to the interactive init setup if it is not specified. Currently there is no such flag available, and surprised there isn't any planned in the roadmap.

hamidrasool@LAPTOP:~/copilot-demo-app$ copilot init --region eu-west-1
✘ unknown flag: --region

Current workaround is to add the region manually into ~/.aws/config if needed to deploy for any particular region which should not be needed as it forces user to change their default settings for profile. Alternately setting a new profile for this purpose for each required region is equally not a pleasant user experience.

System tested on: Ubuntu 18.04 on WSL2

arecreds typbug typrequest

All 4 comments

Thanks @shrasool ! Glad you found the workarounds to get it working for now, we have a story (#36) to track permission related issues and we'll updated that issue as we improve the UX for our environment and application initialization!

Heya @shrasool we released v0.3.0 which now prompts for a region if we don't detect one while running copilot env init!

Hi Guys,

I'm new to that tool however it fails for me due to MissingRegion.

I checked out the repo https://github.com/aws-samples/aws-copilot-sample-service.git and run copilot init which asked me for app name, and then it failed

copilot init
Welcome to the Copilot CLI! We're going to walk you through some questions
to help you get set up with an application on ECS. An application is a collection of
containerized services that operate together.

Application name: demo
✘ get application demo: get application demo: MissingRegion: could not find region configuration

I deliberately don't use the default region in my AWS config file and don't plan to start (as it is easy to execute to commend against the default region instead of intended one).

@efekarakus how can I specify the region?

Also this fails as well

copilot env init
✘ ask for application: list applications: list applications: MissingRegion: could not find region configuration

UPDATE:
I figured that exporting $AWS_REGION does the trick.

Awesome glad you got it working @serverlesspolska !

Was this page helpful?
0 / 5 - 0 ratings

Related issues

BenediktMiller picture BenediktMiller  Â·  3Comments

kohidave picture kohidave  Â·  3Comments

iamhopaul123 picture iamhopaul123  Â·  3Comments

aviflax picture aviflax  Â·  4Comments

mikelhamer picture mikelhamer  Â·  3Comments