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

Reduce timeout for accessing EC2 instance metadata service #159

Merged
merged 1 commit into from
Mar 10, 2021

Conversation

lfittl
Copy link
Member

@lfittl lfittl commented Mar 9, 2021

Previously we were re-using our shared HTTP client, which has a rather
high timeout (120 seconds) that causes the HTTP client to wait around
for a long time. This is generally intentional (since it includes the
time spent downloading a request body), but is a bad idea when running
into EC2's IDMSv2 service that has a network-hop based limit. If that
hop limit is exceeded, the requests just go to nowhere, causing the
client to wait for a multiple of 120 seconds (~10 minutes were observed).

This instead uses a special client for the EC2 instance metadata service
that has a much lower timeout (1 second, like in the AWS SDK itself), to
avoid the problem.

See also aws/aws-sdk-go#2972

Previously we were re-using our shared HTTP client, which has a rather
high timeout (120 seconds) that causes the HTTP client to wait around
for a long time. This is generally intentional (since it includes the
time spent downloading a request body), but is a bad idea when running
into EC2's IDMSv2 service that has a network-hop based limit. If that
hop limit is exceeded, the requests just go to nowhere, causing the
client to wait for a multiple of 120 seconds (~10 minutes were observed).

This instead uses a special client for the EC2 instance metadata service
that has a much lower timeout (1 second, like in the AWS SDK itself), to
avoid the problem.

See also aws/aws-sdk-go#2972
@lfittl lfittl requested a review from msakrejda March 9, 2021 23:11
@lfittl lfittl merged commit eec7426 into master Mar 10, 2021
@lfittl lfittl deleted the reduce-ec2-imds-timeout branch March 10, 2021 18:13
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.

2 participants