snapshot: fetch credentials from EC2IMDS #2
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This action relies on
AWS_REGION
ENV variable provided by cloudinit (EC2 user data).If
aws-actions/configure-aws-credentials
is used after this action, AWS action will cleanup allAWS_
ENV variables in post step.This will result in
failed to resolve service endpoint, endpoint rule error, Invalid Configuration: Missing Region
errors inruns-on/snapshot
post step.AWS_REGION
afterconfigure-aws-credentials
post step.configure-aws-credentials
before this action generally won't work, since assumed role probably won't have access to RunsOn AWS resources.configure-aws-credentials
, which would require manually passing outputs of that step to every step that needs AWS credentials, which can be cumbersome.I suggest that we default to
RUNS_ON_AWS_REGION
, and if this ENV variable is not set,config.WithRegion
will receive empty string, in which case it behaves like before (at least documentation says so.)Region is determined in a similar way as in runs-on/cache.
Long term,
RUNS_ON_AWS_REGION
in conjunction with https://github.com/aws/aws-sdk-go-v2/credentials/ec2rolecreds could be used to ensure that EC2 instance profile is used regardless ofAWS_
variables and~/.aws
configuration.