How can I connect to an Amazon S3 bucket from an application running on an Elastic Beanstalk instance?
Last updated: 2019-11-19
How can I connect to an Amazon Simple Storage Service (Amazon S3) bucket from an application running on an AWS Elastic Beanstalk instance?
To connect to Amazon S3 from Elastic Beanstalk, verify that your AWS Identity and Access Management (IAM) instance profile is attached to an Amazon Elastic Compute Cloud (Amazon EC2) instance with the right permissions for Amazon S3. Then, confirm that your S3 bucket policy doesn't have a policy that denies access to the role attached to your instance profile.
Validate permissions for your instance profile
- Open the Elastic Beanstalk console.
- Select your environment.
- From the navigation menu, choose Configuration.
- In the Configuration overview section, from the Category column, for Security, choose Modify.
- From the IAM instance profile menu, note the name of your instance profile.
- Open the IAM console.
- In the navigation pane, choose Roles.
- In the search box, enter the name of your instance profile from step 5.
- Verify that the role from step 8 has the required Amazon S3 permissions for the bucket that you want to access.
Validate permissions for your S3 bucket
- Open the Amazon S3 console.
- From the list of buckets, choose the bucket with the bucket policy that you want to change.
- Choose the Permissions tab.
- Choose Bucket Policy.
- Search for statements with "Effect": "Deny".
- In your bucket policy, edit or remove any "Effect": "Deny" statements that are denying the IAM instance profile access to your role.
Connect to your S3 bucket
You can now connect to your S3 bucket, and then use your S3 bucket to: