10

Some examples in internet have AWS_DEFAULT_REGION env variable set but some others AWS_REGION. What is the difference? Which services use one or another?

Cherry
  • 25,428
  • 40
  • 160
  • 286
  • Both are same, they have updated env variable to `AWS_DEFAULT_REGION`, here is the documentation https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html – Ahmet Zeybek Jan 29 '20 at 07:11

2 Answers2

13

They are not the same: one works in some situations and the other works in other situations.

e.g. I just learned that AWS_DEFAULT_REGION does not work with the AWS Java API library. See Force AWS library to obtain region from environment inside docker cluster

cf. 44151982, 36354423, Github aws/aws-sdk-go#2103

danorton
  • 11,049
  • 7
  • 37
  • 51
2

AWS_DEFAULT_REGION and AWS_REGION is the same.

They first introduce AWS_REGION in SDK and then AWS_DEFAULT_REGION comes later. it is also asked in their aws-cli

AWS_DEFAULT_REGION - Specifies the AWS Region to send the request to. If defined, this environment variable overrides the value for the profile setting region. You can override this environment variable by using the --region command line parameter. source

user2398347
  • 114
  • 3