-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Aws Client slow in initialization (authentication with metadata service) #2506
Comments
Hi @emdotem, thanks for opening this issue. We will investigate the reported behavior and I will get back to you as soon as possible. Thanks! |
Thank you for replying this fast. If you want me to provide more info, I can help you, even with a live call together. |
Hi @emdotem, sorry for the delayed response. After looking deep into this I found that after implementing the solution from this comment the latency is gone, which is basically increasing the hop limit for my instance from 1 to >1. Please see below the command to do this from the aws cli:
aws ec2 modify-instance-metadata-options
--instance-id YOUR-INSTANCE-ID \
--http-put-response-hop-limit 3 So, could you please try this and let me know if work for you? Another alternatives would be to use another credential provider like shared credentials file. You can find more information here. Thanks! |
This is not really a good approach, AWS suggests to not generate key and rather use the metadata server to retrieve the credential. Can you explain what's the hop limit? What are the consequences on doing so? |
It solves the issue, but I'd like to know more about this limit if possible. Before:
After:
|
@emdotem You can find further information about this here, most likely search for the title "Protecting against open layer 3 firewalls and NATs".
Thanks! |
@emdotem I will close this issue now, but please if you have any questions just let me know. Thanks! |
|
Describe the bug
Hello,
We are running a very annoying bug that is making the whole application slow. Basically the first time we interact with AWS sdk, whatever is the command, it takes around 1 second, the subsequent commands are 100x faster (2 order of magnitude).
My best guess is that it takes 1 second to contact the metadata service for the authentication.
We run on EC2, using Docker and we use Apache as webserver. Every new request performs a new call to the metadata service since the authentication is not shared across different processes.
Finally, I tag an old issue that it doesn't seem to be fixed:
Expected Behavior
Authentication should be fast, in the order of milliseconds, not seconds.
Current Behavior
Authentication using metadata service (my guess) takes 1 second. Every request that need to contact AWS take at least 1 second.
Reproduction Steps
Initialize the AWS client without specifying access secret and key, call the same command one after the other:
You'l notice that t1-t0 is greater than 1s while t2-t1 is in the order of milliseconds
Possible Solution
No response
Additional Information/Context
No response
SDK version used
3.179.2
Environment details (Version of PHP (
php -v
)? OS name and version, etc.)PHP 7.4
The text was updated successfully, but these errors were encountered: