Skip to content

InstanceProfileCredentialsProvider is slow to get credentials since 1.11.678 #2171

@joelittlejohn

Description

@joelittlejohn

For apps that have any kind of indirect network configuration (e.g. docker, k8s, ECS, etc), the InstanceProfileCredentialsProvider now hangs for 10 seconds before providing credentials. This has been reported in other SDKs:

aws/aws-sdk-ruby#2177
aws/aws-sdk-go#2972

The problem appears to be that the SDK now uses PUT /latest/api/token to create credentials, but this PUT API is subject to a hop limit so the request does not succeed. Instead it hangs waiting for a response. After 10 seconds a timeout exception is thrown and the SDK falls back to the usual GET /latest/meta-data/iam/security-credentials/... which succeeds.

This can be fixed like:

aws ec2 modify-instance-metadata-options --instance-id <instance ID> --http-put-response-hop-limit 3 --http-endpoint enabled

however it seems like a major issue that all instances will now need to be modified in this way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions