Miserlou / Zappa

Serverless Python
https://blog.zappa.io/
MIT License
11.89k stars 1.2k forks source link

"zappa init" does not add an AWS region if deployment is not global #913

Open marcoesposito1988 opened 7 years ago

marcoesposito1988 commented 7 years ago

Context

"zappa init" asks if the user would like to deploy the lambda function globally, in all AWS regions. If the user chooses "no", the zappa_settings.json does not contain an "aws_region" entry, and the deployment fails. Should the script propose a list of regions and ask the user to choose one? Or just prompt a reminder to add an aws region after the script is done? ## Expected Behavior
  1. zappa init Would you like to deploy this application globally? (default 'n') [y/n/(p)rimary]: n
  2. zappa deploy
  3. profit!

Actual Behavior

  1. zappa init Would you like to deploy this application globally? (default 'n') [y/n/(p)rimary]: n
  2. zappa deploy
  3. botocore.exceptions.NoRegionError: You must specify a region.

Possible Fix

We could either:

sibblegp commented 7 years ago

I don't encounter this error. Maybe you don't have a default region set for your AWS credentials?

mackaltman commented 6 years ago

I agree with @sibblegp. I would recommend reviewing the Quick Configuration in the Configuring the AWS CLI section of the AWS Documentation.

rennomarcus commented 5 years ago

I had the same problem encountered by @marcoesposito1988 . I just ran the aws configure command (you can see in the links provided by @mackaltman ). This will create a file in your ~/.aws/config file (note that is not the credentials file). You should see the region there.

vc1492a commented 5 years ago

I did as @rennomarcus described and this resolved the issue for me. While this configuration may be best kept to awscli, it perhaps would be helpful if Zappa could detect the absence of a default region setting and suggest the proper course of action to the user (run aws configure).

iPythonezta commented 1 year ago

@vc1492a or @rennomarcus , Can any one of you describe how exactly did you guys solved the problem and also I will be able if one of you can send a sample of how the zappa_settings.json file look like