- Newest
- Most votes
- Most comments
The issue you're experiencing with Elastic Beanstalk not being able to access the AWS-managed S3 bucket is likely related to IAM permissions rather than an AWS service bug. Here are some troubleshooting steps to resolve this:
- Check IAM Role Permissions: While you mentioned that you're using the
AWSElasticBeanstalkWebTierpolicy, this might not be sufficient. Elastic Beanstalk environments typically need two roles:
- An instance profile role for the EC2 instances
- A service role for Elastic Beanstalk itself
- Verify S3 Permissions: The service role needs specific S3 permissions to access the elasticbeanstalk-env-resources bucket. Ensure your service role has at minimum:
- s3:GetObject
- s3:GetObjectVersion
- s3:ListBucket
- s3:ListBucketVersions
-
Check for S3 Bucket Policy Conflicts: If there are any custom bucket policies in your account, they might be conflicting with the permissions Elastic Beanstalk needs.
-
Review Account-level S3 Settings: Check your account's S3 Block Public Access settings, as overly restrictive settings might interfere with Elastic Beanstalk's ability to configure the S3 bucket properly.
-
Examine VPC Configuration: If you're using a custom VPC, ensure it's properly configured with the necessary components like internet gateway, security groups, and subnets to allow traffic between Elastic Beanstalk and S3.
-
Check CloudTrail Logs: Review AWS CloudTrail logs to identify specific denied actions related to S3 access, which can provide more details about the permission issues.
For CodePipeline specifically, you may need to ensure that the CodePipeline service role has the necessary permissions to interact with both Elastic Beanstalk and S3. Consider adding a custom policy to your service role that explicitly grants access to the required S3 buckets.
This is most likely a configuration issue rather than a bug in AWS services. By properly configuring the IAM roles and permissions, you should be able to resolve the access denied errors.
Sources
When creating an elastic beanstalk environment it gets terminated throwing a S3_MALFORMED_POLICY error | AWS re:Post
Setup Elastic Beanstalk with S3 | AWS re:Post
Troubleshoot issues with Amazon ECS connection to Amazon S3 | AWS re:Post
Resolve Access Denied errors in CodePipeline | AWS re:Post
Hello.
Can you share the error message?
You need to determine whether the problem is with the ElasticBeanstalk IAM role or with the IAM role or other settings configured for CodePipeline.
It is also possible that the IAM role used by CodePipeline, CodeBuild, etc. does not have the permissions to access "elasticbeanstalk-env-resources-us-east-2", causing the error.
https://docs.aws.amazon.com/codepipeline/latest/userguide/how-to-custom-role.html
Hello,
The error message I received on the Deploy stop of the Pipeline is as follows:Deployment completed, but with errors: Failed to deploy application. Service:Amazon S3, Message:Access Denied: S3Bucket=elasticbeanstalk-env-resources-us-east-2, S3Key=eb_patching_resources/instance_patch_extension.linux
Based on my understanding the IAM role that needs the permission to access "sticbeanstalk-env-resources-us-east-2" is the eb instance profile role which for me is: aws-elasticbeanstalk-ec2-role which I do have the AWSElasticBeanstalkWebTier policy attached.
Does the IAM role used by CodePipeline need additional S3 permissions for the "sticbeanstalk-env-resources-*" bucket? My understanding is that the IAM role used by the CodePipeline is for the pipeline's artifact bucket rather than what is needed for operations within the Beanstalk environment.
Relevant content
- asked 2 years ago

I have tried adding AWSElasticBeanstalkWebTier to both instance role and service role but ended up still getting the same error. The S3 bucket itself is managed by AWS so I am not allowed to verify or change its permissions. I do not see the bucket under my S3.