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.
2
Answers
EC2 instances use
instance profiles
(which are actuallyIAM Roles
) to determine their access permissions.What you need to do:
IAM
AmazonS3FullAccess
orAmazonS3ReadOnlyAccess
depending on if you want just read permissions or write as well)Actions -> Security - Modify IAM Role
You can read more in AWS official documentation regarding Instance profiles
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