go2chef icon indicating copy to clipboard operation
go2chef copied to clipboard

Support aws sources defaulting to derived local region

Open kcbraunschweig opened this issue 5 years ago • 0 comments

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.

kcbraunschweig avatar Mar 25 '20 00:03 kcbraunschweig