Skip to content

Conversation

ssabo
Copy link

@ssabo ssabo commented Sep 1, 2020

Signed-off-by: Shaun Sabo shaunsabo@slack-corp.com

I noticed that I cannot force the SDK to load my .aws/config which I volume mounted into the registry container at /root/.aws/config. I want to do this so I can run a registry in a different AWS account from where the S3 bucket is located without using Access Keys. Ideally, I would like to achieve this by using role_arn and credential_source = Ec2InstanceMetadata in the shared config to assume a role in the account where the bucket is located.

Currently if we provide AWS_SDK_LOAD_CONFIG=1 to the registry, it will not actually use the config located at ~/.aws/config. I believe this is because defaults.Config() loads a full *aws.Config object who's Credentials override the detection that session.NewSession() does.

By starting with a sparse object with &aws.Config{}, I was able to continue to configure the session incrementally without wiping out default behavior for credential discovery.

This patch will maintain existing behavior, except when AWS_SDK_LOAD_CONFIG=1 is set in the environment.

Signed-off-by: Shaun Sabo <shaunsabo@slack-corp.com>
@ob1dev
Copy link
Contributor

ob1dev commented Sep 6, 2020

Looks like a duplicate of #3245.

@ssabo
Copy link
Author

ssabo commented Sep 6, 2020

I agree, looks like we effectively came to same solution too 😂

@ssabo
Copy link
Author

ssabo commented Sep 9, 2020

@olegburov I am going to close my PR in favor of yours. Please let me know if there is anything I can do to help out with your branch.

@ssabo ssabo closed this Sep 9, 2020
@ob1dev
Copy link
Contributor

ob1dev commented Sep 9, 2020

@ssabo if you could double check that my changes still work for you that would add more confidence and help reviewes to approve it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants