Possible fix for aws profile assumeRole from ec2InstanceRole issues: #3038
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.
Possible fix for aws profile assumeRole from ec2InstanceRole issues:
#1521
#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.