Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between AWS_DEFAULT_REGION and AWS_REGION system variables?

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?

like image 812
Cherry Avatar asked Jan 29 '20 07:01

Cherry


People also ask

What are AWS environment variables?

PDFRSS. You can use environment variables to adjust your function's behavior without updating code. An environment variable is a pair of strings that is stored in a function's version-specific configuration.

How do I get AWS Region in Lambda?

To get the AWS Region where your Lambda Function is running you will need to import the os module. Then from the os module, you need to get the value of AWS_REGION from the environ mapping variable. This will return the AWS Region where the Lambda Function is running.


1 Answers

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

like image 66
danorton Avatar answered Sep 21 '22 04:09

danorton