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

Pages open slowly with EC2 Instance Role #4

Closed
sleonov-cloud opened this issue Feb 7, 2022 · 4 comments
Closed

Pages open slowly with EC2 Instance Role #4

sleonov-cloud opened this issue Feb 7, 2022 · 4 comments

Comments

@sleonov-cloud
Copy link

Hi!

This is a very cool fork, thank you.
Everything works fine with credentials, pages open quickly and correctly.
But there is a problem with EC2 Instance Role - pages open very slowly ((
How can I fix it?
My docker-compose.yml:
proxy:
image: patrickdk/s3-proxy
ports:
- 8080:80
environment:
- AWS_REGION=
- AWS_S3_BUCKET=
- BASIC_AUTH_USER=
- BASIC_AUTH_PASS=
- ACCESS_LOG=true
- DIRECTORY_LISTINGS=true
- DIRECTORY_LISTINGS_FORMAT=html
container_name: proxy

@patrickdk77
Copy link
Owner

That isn't something I would want to take on, it will take considerable effort. I don't have any personal usecases for that at the moment.

The issue is, to get the access token, it has to make two tcp connections to fetch it from aws, and it expires after 60minutes, where it would need to fetch it again. I'm guessing the way it is done now, it's just asking the aws sdk to handle it, and it's getting a new token for every request, causing it to be slow. If it cached that token, and reused it, it would resolve the slowness issue, but create a new issue of making sure that token is disposed of and replaced with a new one before it is expired.
I have had to handle this in a nodejs app before so I do know the trouble space. But don't have the time to work that kind of major change to the sdk auth logic at the moment.

@sleonov-cloud
Copy link
Author

Thanks for the detailed answer.

@patrickdk77
Copy link
Owner

issue is with aws-sdk still:
EC2 roles slow

Working on implementing the workaround.

@patrickdk77
Copy link
Owner

Ah the workarounnd I cannot do, you have to do it on your instances

aws ec2 modify-instance-metadata-options
--instance-id i-1234567898abcdef0
--http-put-response-hop-limit 3
--http-endpoint enabled

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

No branches or pull requests

2 participants