-
Notifications
You must be signed in to change notification settings - Fork 367
Fargate Region Support #553
Description
Is your feature request related to a problem? Please describe.
When running in Fargate, EC2 Metadata is not available, which causes looking up the region to fail. Based on the implementation of getRegion() or getCurrentRegion() this is nothing this is not a bug of spring-cloud-aws. Note the "If not in EC2 return null" in the following doc.
https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/regions/Regions.html
In Fargate, EC2 Metadata is not available however, the environment variable AWS_REGION is, and is also set on most local testing environments.
Describe the solution you'd like
In the following function of spring-cloud-aws test if the returned value of getRegion() is null and if so check for the environment variable AWS_REGION and use that.
Describe alternatives you've considered
Currently the work around is to set the property of "static region" as follows;
cloud.aws.region.static=${AWS_REGION}
Additional context
I looked for others that might have raise this issue but did not find thing. Basically this caused a bit of a run around when trying to deploy to Fargate, and I think by implimenting this small change it would save many people quite a bit of hassle if / when they deploy to Fargate.