Home > Net >  Issue with sending requests to S3 bucket on AWS
Issue with sending requests to S3 bucket on AWS

Time:11-30

I am using Amazon's sample code to connect to my S3 bucket. I have changed the key and bucket name for that of my bucket in S3. I have tried using the standard bucket name and using access points however I am still getting the following error.

Error CredentialsProviderError: Could not load credentials from any providers

I am unsure what exactly this error is saying I have missed, and also what credentials I need and how to recieve them.

I am relatively new to AWS so any help would be much appreciated.

I am running my code to access the bucket on an EC2 instance within the same VPC as the bucket so I was assuming I would not need additional permissions or credentials.

I am relatively new to AWS so any help would be much appreciated.

CodePudding user response:

EC2 instances use instance profiles (which are actually IAM Roles) to determine their access permissions.

What you need to do:

  1. Go to IAM
  2. Create a Role for EC2
  3. Attach permissions to the Role (either create a new policy, or attach some AWS Managed policy, like AmazonS3FullAccess or AmazonS3ReadOnlyAccess depending on if you want just read permissions or write as well)
  4. Go to EC2
  5. Select EC2 instance
  6. Actions -> Security - Modify IAM Role

You can read more in AWS official documentation regarding Instance profiles

CodePudding user response:

This error message means your application cannot find the credentials (An access key ID, A secret access key) required to use the AWS SDK for JavaScript. As you are using the JavaScript SDK, you need to read the JavaScript Developer Guide here:

https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/getting-your-credentials.html

  • Related