aws-sdk-java icon indicating copy to clipboard operation
aws-sdk-java copied to clipboard

Possible fix for aws profile assumeRole from ec2InstanceRole issues:

Open gss2002 opened this issue 2 years ago • 0 comments

Possible fix for aws profile assumeRole from ec2InstanceRole issues:

https://github.com/aws/aws-sdk-java/issues/1521 https://github.com/aws/aws-sdk-java/issues/1713

Issue #, if available: #1521 and #1713

*Description of changes: * This code change is a possible solution to resolve using AWS Profile files not correctly utilizing credential_source such as Ec2InstanceMetadata and being forced to only utilize AccessKey/Secret. I have tested with AWS's official version of the Redshift JDBC Driver and it does work and solve the problem of not being able to utilize credential_source. I was able to successfully test with AWS's Redshift JDBC Driver using Ec2InstanceMetadata and utilized assumeRole operation to use a different role both in the local account and in a cross account methodology.

Example of what did not work with aws-java-sdk v1 before this fix.

[default] credential_source=Ec2InstanceMetadata region=us-east-1 output=json

[redshift_iam] role_arn=arn:aws:iam::xxxxxxxxxxxx:role/xxxx-data-dev-idmc-poc region=us-east-1 source_profile=default output=json

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

gss2002 avatar Oct 18 '23 12:10 gss2002