Giter Club home page Giter Club logo

Comments (8)

alextwoods avatar alextwoods commented on September 26, 2024

What do you mean by "hammer the credentials endpoint with valid credentials"?

Can you provide any code to reproduce the issue? What service and operation are you trying to use and how are you constructing a client?

from aws-sdk-ruby.

michaelglass avatar michaelglass commented on September 26, 2024

from rails, from an AWS instance, with credentials from the instance

1000.times.map { Thread.new { Aws::S3::Client.new(region: 'us-east-2').head_object(bucket: 'my_bucket', key: 'my_file.txt') } }.map(&:join)

reproduces the error for me.

sometimes I have to futz with the number (2000? 3000?) to consistently reproduce.

from aws-sdk-ruby.

alextwoods avatar alextwoods commented on September 26, 2024

In general you should only be creating a single client - the AWS service clients are thread safe and can safely be shared and re-used across your application.

The InstanceProfileCredentials (EC2 credentials) is part of the Credential Provider Chain, which requires that credential providers that encounter errors or otherwise fail to load/fetch credentials don't raise errors and skip to the next provider in the chain - so I dont think that we can/should surface an error during that process. We also defer raising any missing credential related errors until an operation that requires credentials is called (since there are unsigned operations and it must be possible to use the client without credentials for those operations).

If you know the type of credentials your application needs ahead of time, you can explicitly check and configure them.

from aws-sdk-ruby.

michaelglass avatar michaelglass commented on September 26, 2024

Yup -- the issue is not at all blocking. Just when we got the error it was misleading.

from aws-sdk-ruby.

alextwoods avatar alextwoods commented on September 26, 2024

Yeah - thats fair - getting to the root cause issue there is difficult. I'll look into the possibility of adding some logging for such failures.

from aws-sdk-ruby.

solomon-maeng avatar solomon-maeng commented on September 26, 2024

@alextwoods

What if I create 100 or more AWS S3 clients instead of a single client?

I'm asking because I want to know more about creating S3 clients.

from aws-sdk-ruby.

alextwoods avatar alextwoods commented on September 26, 2024

There is some overhead in creating a client, so its generally recommended to create only a single client (per set of configuration options) and share it across your application.

When you create a service client, it will attempt to resolve all of the configuration options. For credentials (unless credentials are explicitly provided) it uses the credential provider chain, which will check each credential provider in order until one of them is able to resolve credentials. With the InstanceProfileCredentials it will make a request to the local EC2 credentials endpoint. If you're creating a large number of clients at one time, this could overwhelm that endpoint and cause it to start throttling requests.

from aws-sdk-ruby.

github-actions avatar github-actions commented on September 26, 2024

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

from aws-sdk-ruby.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.