Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change aws credentials provider order and parametrize aws profile name #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

skoppe
Copy link

@skoppe skoppe commented Feb 22, 2018

No description provided.

@huima
Copy link

huima commented Feb 22, 2018

Thanks for the pull request, we'll check it out soon.

new InstanceProfileCredentialsProvider(),
new ProfileCredentialsProvider(),
new ProfileCredentialsProvider(awsProfile),
new EC2ContainerCredentialsProviderWrapper(),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest you look at doing something like this - verygoodsecurity@7672449#diff-bc25e29340c2c636b9eac497e8efc484R28

DefaultAWSCredentialsProviderChain - https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/credentials.html

AWS credentials provider chain that looks for credentials in this order:

  • Environment Variables - AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY (RECOMMENDED since they are recognized by all the AWS SDKs and CLI except for .NET), or AWS_ACCESS_KEY and AWS_SECRET_KEY (only recognized by Java SDK)
  • Java System Properties - aws.accessKeyId and aws.secretKey
  • Credential profiles file at the default location (~/.aws/credentials) shared by all AWS SDKs and the AWS CLI
  • Credentials delivered through the Amazon EC2 container service if AWS_CONTAINER_CREDENTIALS_RELATIVE_URI" environment variable is set and security manager has permission to access the variable,
  • Instance profile credentials delivered through the Amazon EC2 metadata service

https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/index.html?com/amazonaws/auth/DefaultAWSCredentialsProviderChain.html

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know about the DefaultAWSCredentialsProviderChain. I would have used it, but I need to be able to overwrite the profileName, and the DefaultAWSCredentialsProviderChain does not allow that.

You see, in our cause we have multiple aws accounts, and our application itself needs to run under one profile, and the build under another (because our s3 bucket is located in another account).

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.

3 participants