Support aws sources defaulting to derived local region
kcbraunschweig opened this issue · 0 comments
kcbraunschweig commented
AWS-specific sources will often be used from an aws instance with access to the aws metadata service. This is already used by the sdk to provide credentials if they aren't in the config. However the sdk doesn't provide a way to automatically derive the current region before creating a session even though the metadata service will tell you where you are.
Instead, when using a source like s3 or secretsmanager, if region isn't specified, manually query the metadata to find our current region and use it if available. To do this, basically:
curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone
Then strip off the last character and that will be your region.