
Under the Hood of AWS Elastic Beanstalk Cluster Mode: Architecture and Real-World Troubleshooting
Explore how Elastic Beanstalk leverages Amazon EKS and EKS Auto Mode behind the scenes, including cluster reuse, IAM roles, and networking. Learn from real-world deployment failures involving image pulls, load balancer discovery, and IAM authorization, alongside practical troubleshooting steps and a pre-deployment checklist.
Hi Lovely Reader (LR), it’s Roslaan here again!
When AWS introduced Cluster Mode for Elastic Beanstalk, it changed a lot about how developers deploy applications. A new infrastructure layer powered by Amazon Elastic Kubernetes Service (EKS), with EKS Auto Mode managing much of the compute infrastructure behind the scenes was introduced.
In my previous articles, I wrote about what changed with Elastic Beanstalk Cluster Mode and then did a walk through deploying my first application.
But you see this time, I am going deeper.
Because although Elastic Beanstalk abstracts much of the Kubernetes complexity, it doesn’t mean you can just completely ignore Kubernetes, networking, IAM permissions, or the infrastructure that supports your workloads.
During my deployment investigation, I encountered several issues involving node networking, load balancer subnet discovery, and IAM permissions. I also examined how long AWS takes to provision the underlying EKS infrastructure.
These encounters gave me a better understanding of what actually happens behind the familiar Elastic Beanstalk deployment experience.
In this article, I’ll explore the architecture, walk through three infrastructure problems I encountered, and highlight some things worth checking before deploying your first environment.
Let’s get into it.
1. Understanding the Architecture Behind Elastic Beanstalk Cluster Mode
The first thing you probably need to understand is that Elastic Beanstalk Cluster Mode is not simply another way to launch EC2 instances.
Instead of deploying application code directly onto dedicated EC2 instances, Cluster Mode uses Amazon EKS to run containerized workloads.
The high level architecture involves:
- AWS Elastic Beanstalk: Manages application environments and deployment lifecycles.
- Amazon EKS: Provides the Kubernetes control plane for orchestrating workloads.
- EKS Auto Mode: Manages the compute infrastructure required by workloads.
- Amazon ECR: Stores container images used by applications.
- Elastic Load Balancing: Provides application ingress through an Application Load Balancer.
- Amazon VPC: Provides networking infrastructure, including subnets and routing.
An amazing architectural decision here; is that multiple Elastic Beanstalk environments can reuse an existing EKS cluster when they share the same subnet configuration.
This means creating another environment doesn’t require provisioning another EKS cluster.
Instead, environments can run as separate application workloads within the shared cluster, using separate Kubernetes namespaces.
This honestly changes a lot about how we think about infrastructure provisioning, environment isolation, and resource allocation.
Shared clusters and environment isolation
During my investigation, I found out that subnet selection plays an important role in cluster reuse for Benstalk cluster mode.
When the first environment is created using a particular subnet configuration, Elastic Beanstalk provisions the underlying cluster infrastructure.
Subsequent environments using the same subnet configuration can reuse that cluster, provided that the relevant cluster-level configuration is compatible.
This is great because the initial environment incurs the infrastructure provisioning process, while subsequent environments avoids repeating the entire process, this eases developers painjs a lot
However, sharing the same cluster does not equate to sharing the same application namespace or replicas because each environment maintains its own application workload within the cluster.
It is also great tp understand that choosing a different subnet configuration can definitely result in a separate cluster creation if such cluster does not exist in that subnet before.
Therefore, subnet selection is not just a networking decision because it will influence how Elastic Beanstalk groups and reuses the infrastructure.
2. Troubleshooting Cluster Mode: Three Problems I Encountered
like I have previously said that understanding the architecture is just one thing. Getting everything to work is another huge work.
During my deployment, I encountered three infrastructure problems that revealed some important details about the interaction between networking, Kubernetes, AWS load balancing, and IAM.
2.1 Problem One: The Networking Configuration That Prevented Image Pulls
The first major problem I encountered was during the cluster provisioning.
CloudFormation remained in progress for I think an hour or so before the stack eventually failed.
I discovered the failure was associated with the Cert-Manager add-on.
The error included:
LogicalResourceId: CertManagerAddonStatus: CREATE_FAILEDPods are waiting because: ImagePullBackOffBack-off pulling image:049637491884.dkr.ecr.eu-west-2.amazonaws.com/eks/cert-manager-cainjector:...dial tcp 3.8.36.254:443: i/o timeout
On first look,, I thought it’s like an Amazon ECR problem.
However, when i investigated the VPC configuration, i found something more interesting.
I found out that cluster subnets had route tables configured with a default route pointing to an Internet Gateway:
Destination: 0.0.0.0/0Target: igw-xxxxxxxx
The route tables looks correct.
However, the subnet attribute
MapPublicIpOnLaunch was disabled. This was big the critical detail.An Internet Gateway does not automatically provide internet connectivity to every instance launched in a subnet associated with it because for an instance to communicate directly with the internet through an Internet Gateway, it needs a public IPv4 address.
The route table is the one that determines where traffic should go, while the public IP address enables the Internet Gateway to perform the necessary address translation.
In my deployment, the worker nodes did not have the required public IPv4 connectivity. and so because of that, they could not retrieve the required container images from Amazon ECR.
This resulted in the
ImagePullBackOff , preventing the add-on from becoming ready.
How I remediated it
For the public-subnet configuration used in my test environment, I enabled automatic public IPv4 assignment:
aws ec2 modify-subnet-attribute \ --subnet-id <subnet-id> \ --map-public-ip-on-launch
I did this for the other public subnet used by the cluster. and this addressed the connectivity issue in that setup.
The lesson I learnt better here is that having an Internet Gateway route does not automatically make instances internet-accessible.
For production environments, private worker-node subnets with appropriate outbound connectivity through NAT Gateways or suitable VPC endpoints are what is going to be used.
I used public subnets during the deployment to avoid the additional NAT Gateway cost. That was a deliberate testing decision, not a recommendation to expose production worker nodes.
2.2 Problem Two: ALB Subnet Discovery and Kubernetes Tagging
After resolving the networking problem, the next challenge involved application ingress and load balancing.
When Kubernetes needs to provision an internet-facing or internal load balancer, the relevant subnet configuration and discovery tags matter.
For the subnet configuration I was working with, I needed to ensure that the appropriate Kubernetes subnet role tags were present.
For the public subnets:
aws ec2 create-tags \ --resources <subnet-1> <subnet-2> \ --tags Key=kubernetes.io/role/elb,Value=1
For the private subnets:
aws ec2 create-tags \ --resources <private-subnet-1> <private-subnet-2> \ --tags Key=kubernetes.io/role/internal-elb,Value=1
These tags will help the relevant load-balancing integration to identify the wanted subnets. Without the appropriate discovery configuration, subnet selection or load balancer provisioning may fail.
Another interesting architectural consideration here is that the subnets used by an internet-facing Application Load Balancer do not necessarily have to be the same subnets used by worker nodes.
For example, you can use public subnets for the load balancer while keeping worker nodes in private subnets.
This separation becomes useful when designing production environments.
What I want you to know is that having public subnets and an Internet Gateway may not really be sufficient. The relevant load-balancing integration must also be able to identify which subnets it should use.
Also, don’t forget to always verify the discovery requirements for the particular EKS load-balancing implementation you’re using.
2.3 Problem Three: The IAM Permission Failure Behind the TargetGroupBinding Timeout
I believe this was the most fantastic issue I encountered
After the cluster became available and the networking configurations had been fixed and corrected, application deployments repeatedly failed at the pre-deployment gate.
The error was like this:
Failed to deploy application resources in cluster:deployment pre-deploy gate failedtimed out after 3m0s waiting fortarget group binding and its health check to reconcilecontext deadline exceededMere looking at this, it would have been easy to say that the application was unhealthy or Kubernetes could not schedule the pods.
However, the error indicated that the TargetGroupBinding was not being reconciled successfully. I decided to investigate the Kubernetes events.
Investigating Kubernetes events
I queried the events in the affected environment namespace:
kubectl get events \ -n <namespace> \ --sort-by='.lastTimestamp'
The events revealed the actual problem:
Warning FailedDeployModelFailed to create listener rule:operation error Elastic Load Balancing v2: CreateRuleStatusCode: 403api error AccessDenied
The request was made using an assumed role associated with the EKS Auto Mode cluster.
The denied action was:
elasticloadbalancing:CreateRuleThis wowed me so I had to chnage the turn of my investigation because it seemed problem was not simply an application deployment timeout.
I noticed load-balancing integration was attempting to create an Application Load Balancer listener rule, but AWS IAM was denying the request.
Investigating the IAM permissions
I examined the policies attached to the cluster role and compared them with the resources and tags involved in the deployment.
The EKS Auto Mode load-balancing permissions use attribute-based access control (ABAC), including conditions that restrict certain operations based on resource tags.
One of the relevant conditions uses:
"ForAllValues:StringEquals": { "aws:TagKeys": [ "eks:eks-cluster-name", "ingress.eks.amazonaws.com/stack", "ingress.eks.amazonaws.com/resource", "service.eks.amazonaws.com/stack", "service.eks.amazonaws.com/resource" ]}The important detail here is that
ForAllValues:StringEquals evaluates the tag keys supplied in the request. All supplied keys must satisfy the condition.
During my investigation, I discovered that Elastic Beanstalk environment tracking tags were also involved in the load-balancer resource creation workflow.
These included:
elasticbeanstalk:environment-idelasticbeanstalk:environment-name
I then investigated the interaction between these tags and the EKS load-balancing permission conditions. Another great detail was the
AWSElasticBeanstalkEKSTagging managed policy.This policy provides additional permissions associated with Elastic Beanstalk’s EKS integration.
After identifying that the policy was missing from my role configuration, I attached it then also created an issue on the AWS Containers Roadmap to document the problem.
The remediation
First, inspect the policies attached to the cluster role:
aws iam list-attached-role-policies \ --role-name aws-elasticbeanstalk-eks-cluster-role \ --output table
If the required Elastic Beanstalk tagging policy is missing, attach it:
aws iam attach-role-policy \ --role-name aws-elasticbeanstalk-eks-cluster-role \ --policy-arn arn:aws:iam::aws:policy/AWSElasticBeanstalkEKSTagging
In my investigation, I also evaluated additional IAM permissions to understand the authorization boundary.
However, broad permissions such as allowing ELB operations against
Resource: "*" should not be reated as a production remediation.Start with the documented AWS-managed policies, inspect the actual denied request and its authorization context, and then scope any additional permissions to the resources and actions required.
After correcting the IAM configuration, the Kubernetes events showed successful reconciliation:
Normal SuccessfullyReconciledingress/...Successfully reconciledThe TargetGroupBinding also reconciled successfully, allowing the application deployment to proceed beyond that stage.
My biggest lesson from this investigation is that: A Kubernetes deployment timeout does not always indicate a Kubernetes problem.
Sometimes, the actual failure is an AWS IAM authorization problem underneath the Kubernetes integration.
4. The Practitioner Pre-Flight Checklist
After working through these issues, I put together a checklist for anyone preparing to deploy their first Elastic Beanstalk Cluster Mode environment.
Rather than discovering these requirements during deployment, it is worth checking them beforehand.
IAM roles and policies
Elastic Beanstalk Cluster Mode requires dedicated IAM roles for its EKS infrastructure.
The important roles include:
Role | Purpose |
|---|---|
Cluster role | Manages EKS cluster infrastructure and integrations. |
Node role | Provides the permissions required by worker nodes. |
Observability role | Enables CloudWatch and observability integrations. |
Image build role | Supports application image builds through CodeBuild when deploying from source. |
The recommended role names include:
aws-elasticbeanstalk-eks-cluster-roleaws-elasticbeanstalk-eks-node-roleaws-elasticbeanstalk-eks-observability-roleaws-elasticbeanstalk-eks-image-build-roleVerify that the cluster role has the required AWS-managed policies, including:
-
AmazonEKSClusterPolicy,
-
AmazonEKSNetworkingPolicy
-
AmazonEKSComputePolicy
-
AmazonEKSBlockStoragePolicyV2
-
AmazonEKSLoadBalancingPolicy
-
AWSElasticBeanstalkEKSTagging
Also verify the node and observability roles against the AWS documentation.
Do not forget that the IAM principal creating the environment needs the necessary
iam:GetRole and iam:PassRole permissions.In most cases, I will advise you use the role creation options provided by Elastic Beanstalk and then inspect the resulting policies.
VPC and subnet configuration
Before creating the environment:
- Use subnets across multiple Availability Zones.
- Verify subnet routing and available IP addresses.
- Ensure worker nodes have an appropriate outbound connectivity path.
- Apply the appropriate subnet discovery tags.
- Verify that security groups permit the required traffic.
For public-subnet egress, confirm the Internet Gateway route and public IPv4 assignment where required.
For private subnets, plan NAT Gateway or VPC endpoint connectivity based on the AWS services your nodes need to access.
CodeBuild service quotas
If you deploy application source code instead of providing an existing container image, Elastic Beanstalk uses AWS CodeBuild to build the image.
This introduces another AWS service/Resource.
During my testing, I encountered an account where the regional CodeBuild concurrency quota was zero.
The deployment failed with:
Image build failed for version v1:Cannot have more than 0 builds in queue for the account
You can inspect the applicable quota using:
aws service-quotas get-service-quota \ --service-code codebuild \ --quota-code L-9D07B6EF \ --region <your-region> \ --query "Quota.Value"Verify the current quota code and applicable build type in Service Quotas before requesting an increase.
Or better still, build your container image outside Elastic Beanstalk, push it to Amazon ECR, and deploy the existing image.
This can avoid depending on the source-build workflow during deployment.
Application configuration
Finally, check your application’s container configuration.
The default service port I encountered was
8080 .Your application must listen on the configured port and bind to
0.0.0.0 , rather than only 127.0.0.1 .
Also verify:
- The container image is accessible.
- The health-check endpoint returns a successful response.
- CPU and memory requests and limits are appropriate.
- Startup and readiness probes accommodate application initialization.
- The configured service port matches the application listener.
The final consideration is cluster reuse.
You should understand which subnet configuration determines whether another environment can reuse an existing cluster, and ensure the cluster-level roles are compatible before deployment.
These checks may not prevent every deployment issue, but they can help you avoid several of the problems I encountered.
5. What Does Cluster Mode Mean for DevOps Engineers?
Elastic Beanstalk Cluster Mode introduces an interesting shift in infrastructure responsibilities.
Traditionally, engineers managing containerized applications on AWS may need to spend considerable time managing EC2 instances, Auto Scaling Groups, operating system maintenance, container deployment infrastructure, and load balancer integrations.
With Cluster Mode, AWS manages much of the underlying Kubernetes infrastructure.
However, infrastructure abstraction is not equal to infrastructure disappears.
Engineers still need to understand:
- Kubernetes workload scheduling.
- Container resource requests and limits.
- Application scaling and replicas.
- VPC networking and subnet selection.
- IAM roles and service permissions.
- Load balancing and ingress.
- Container image distribution.
- Application observability.
Shared infrastructure also introduces planning considerations beaucse for example, multiple environments sharing an EKS cluster need appropriate resource allocation, workload isolation, and capacity planning.
Another consideration is application state. Container replicas should not depend on local filesystem storage for important persistent data.
Applications that store uploaded files, session information, or business data should use appropriate external services such as Amazon S3, Amazon RDS, Amazon ElastiCache, or Amazon EFS where shared filesystem access is necessary.
These are not unique Elastic Beanstalk considerations. They are fundamental principles of running distributed containerized applications.
The difference is that Elastic Beanstalk manages much of the application lifecycle while EKS and EKS Auto Mode provide the infrastructure for running the workloads.
6. Conclusion
My experience with Elastic Beanstalk Cluster Mode has been a huge reminder that managed services do not remove the need to understand the infrastructure beneath them.
I also encountered three infrastructure problems that demonstrated why understanding the underlying components matters.
Firstly, an Internet Gateway route alone did not guarantee that worker nodes had the connectivity required to retrieve container images.
Secondly, subnet discovery configuration played an important role in load balancer provisioning.
And finally, a Kubernetes deployment timeout led me to investigate an AWS IAM authorization failure involving
elasticloadbalancing:CreateRule and the permissions required by Elastic Beanstalk's EKS integration.These experiences highlighted an important difference: Elastic Beanstalk simplifies the deployment experience, but the infrastructure supporting applications still needs to be understood and configured correctly.
For DevOps and platform engineers, this is precisely what makes Cluster Mode worth exploring.
The abstraction makes deployment simpler. Understanding what happens underneath makes operating it reliable.
Thanks for reading, Lovely Reader!
See You In The Next One!!! Cheers!!!
The provisioning measurements, configuration observations, and troubleshooting outcomes in this article are from my own testing in AWS eu-west-2. Results and requirements may vary across AWS accounts, regions, and environment configurations.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article