How to find out current region with AWS Lambda?

0 votes

I have a AWS Lambda function written in Java. I want to know if there is a way to find out the AWS region I am currently using through this Lambda function. 

Note: Tried Regions.getCurrentRegion(). It returns null from within an AWS Lambda function.

Dec 20, 2018 in AWS by datageek
• 3,040 points
560 views

1 answer to this question.

0 votes

You can read the AWS_DEFAULT_REGION environment variable and use the Regions.fromNamefunction to parse that into a useable region. The advantage of this is you can use it outside your handler function.

Regions.fromName(System.getenv("AWS_DEFAULT_REGION"))
answered Dec 20, 2018 by Archana
• 5,580 points

Related Questions In AWS

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

How to link AWS Lambda function to Amazon CloudWatch ?

In order to create Log Group and ...READ MORE

answered Jul 20, 2018 in AWS by datageek
• 2,440 points
233 views
0 votes
1 answer

How to add SSL certificate to AWS EC2 with the help of new AWS Certificate Manager service

refer this link  https://aws.amazon.com/certificate-manager/faqs/ You can't install the certificates ...READ MORE

answered Jul 19, 2018 in AWS by Priyaj
• 57,300 points
96 views
0 votes
1 answer
0 votes
1 answer
+2 votes
3 answers
0 votes
1 answer

How to get aws lambda response as an HTML page

Store the HTML markup in a variable and return ...READ MORE

answered Dec 4, 2018 in AWS by Archana
• 5,580 points
155 views
0 votes
1 answer

How to invoke the AWS lambda function from Java code

There are 2 methods in this class which should ...READ MORE

answered Feb 19 in AWS by Archana
• 5,580 points
1,261 views