0

I just created AWS Elastic Beanstalk application using aws-sdk(nodejs). By default its created with the application load balancer. I searched all over and couldn't find any option to tell create the eb app with ALB. Please find below code that use to create eb environment.

const params = {
    ApplicationName: "my-app",
    CNAMEPrefix: "my-app",
    EnvironmentName: "my-env-test",
    VersionLabel: "v1",
    OptionSettings: [
        {
            Namespace: 'aws:autoscaling:launchconfiguration',
            OptionName: 'InstanceType',
            Value: 't2.micro'
        },
        {
            Namespace: 'aws:autoscaling:launchconfiguration',
            OptionName: 'IamInstanceProfile',
            Value: 'aws-elasticbeanstalk-ec2-role-2'
        },
        {
            Namespace: 'aws:elbv2:loadbalancer',
            OptionName: 'CrossZone',
            Value: 'false'
        },
        {
            Namespace: 'aws:elbv2:listener:listener_port',
            OptionName: 'Protocol',
            Value: 'HTTPS'
        }
    ],
    SolutionStackName: '64bit Amazon Linux 2 v5.3.0 running Node.js 14',
};
return await elasticbeanstalk.createEnvironment(params).promise();
Thiwanka Wickramage
  • 782
  • 1
  • 10
  • 22

1 Answers1

0

I fount the solution that we can pass load balancer type in the configuration template like below.

Namespace: 'aws:elasticbeanstalk:environment',
OptionName: 'LoadBalancerType',
Value: 'application'
Thiwanka Wickramage
  • 782
  • 1
  • 10
  • 22