Ticker

6/recent/ticker-posts

How to enable cross-zone load balancing in AWS Elasticbeanstalk


Prerequisite: ElasticBeanstalk, Network Load Balancer

unfortunately, There is no any dedicated option setting in Beanstalk yet to enable Cross zone load balancing in NLB yet, However, we could use resource based ebextensions to implement this.


List of general options for all environment here



Option is available for classtic load balancer however not yet for ALB or NLB


Steps to enable:

  • First, I launched a Beanstalk environment with Network Load Balancer. By default, the Cross zone load balacing was 'Off' for this load balancer as I checked from the EC2 console. 
  • To create a resource based ebextension, I created a file called 'test.config' and placed it in the '.ebextensions' directory in the application source bundle as follows :

Application source bundle:

.
├── .ebextensions
│   └── test.config
├── .elasticbeanstalk
│   └── config.yml
├── .gitignore
├── app.js
├── cron.yaml
├── index.html
└── package.json


The contents of 'test.config' should be as follows in YAML format :

Resources:
  AWSEBV2LoadBalancer:
    Type: AWS::ElasticLoadBalancingV2::LoadBalancer
    Properties:
      LoadBalancerAttributes:
        - Key: load_balancing.cross_zone.enabled
          Value: true


and now deploy the code to elasticbeanstalk.

Happy cloud computing!!

References:

Post a Comment

0 Comments