aws
aws copied to clipboard
Issue with loading credentials from instance metadata
Ran into an issue with loading security credentials from EC2 instance metadata. The code in loadCredentialsFromInstanceMetadata
expects the name of the IAM role to match the data in InstanceProfileArn
. This is true when using the AWS CLI tool, but if instances and IAM roles are set up differently (e.g. through Terraform), that is not necessarily the case.
As far as I can tell looking at both amazonka and the Java SDK the expected way to get security credentials is to use the first role listed in /latest/meta-data/iam/security-credentials
.
The quickest way to get this is always a pull request:)
I just hit this bug as well using Elastic Beanstalk environments which prevents using instance profiles. I'll try to investigate when I'm working with the instance metadata again.