- Newest
- Most votes
- Most comments
Hello.
Why not try assigning "AWSElasticBeanstalkRoleCore" to the IAM role?
This IAM policy is a managed policy used by Elastic Beanstalk to manage the service, so configuring it might make things work.
https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AWSElasticBeanstalkRoleCore.html
When the template body (TemplateBody) exceeds a certain size (the limit for passing it directly inline, approximately 51,200 bytes), CloudFormation performs an internal process where it automatically creates an S3 bucket named cf-templates-<random-string>-<region>, temporarily uploads the template there, and then executes the stack operation.
This aligns perfectly with your situation.
- Creating a new environment (create): The initial CFN template is relatively small and fits inline, so no S3 upload occurs → Success.
- Deploying only a version label: No CloudFormation stack update actually takes place (EB calls APIs equivalent to ASG/EC2/CodeDeploy directly, bypassing CFN) → Success.
- Changing configuration options: EB must reconstruct a larger CFN template reflecting the environment's "fully up-to-date state" and call
UpdateStack. Since this template size exceeds the inline limit, CloudFormation attempts to create a newcf-templates-*bucket → If permissions for bucket creation (s3:CreateBucket) or subsequent actions likePutObjectorPutBucketPolicyare missing, an "Access Denied" error occurs.
Furthermore, the fact you confirmed that no cf-templates-* bucket exists in the account/region strongly suggests that this automatic creation process has never succeeded. Had it succeeded even once in the past, the bucket would already exist.
Question 1: This is a data plane operation (S3 bucket creation and object operations); as you noted, it is not recorded in default CloudTrail management events. To identify it definitively, you need to do one of the following:
Temporarily enable CloudTrail data events to log S3 CreateBucket, PutObject, and PutBucketPolicy events. By examining the event immediately following the configuration change, you can identify the specific principal (likely the service-linked role assumed by the CloudFormation service or the EB service role) and the action that were denied.
Question 2:
If this hypothesis is correct, you need to grant create and write permissions for buckets following the naming pattern cf-templates-* to the principal used internally by EB (typically the EB service role, or in some cases, the calling IAM role).
answered a month ago
