Running non-www stuff on an Elastic Beanstalk Docker container Running non-www stuff on an Elastic Beanstalk Docker container docker docker

Running non-www stuff on an Elastic Beanstalk Docker container


Instead of editing the Load Balancer configuration directly from EC2 web admin it is recommended you do it using elasticbeanstalk ebextensions because those changes persist for your environment even if your EC2 instances in the auto-scaling group are replaced.

Can you try the following?Create a file "01-elb.config" in a folder called .ebextensions in your app source with the following contents:

option_settings:    - namespace: aws:cloudformation:template:parameter      option_name: InstancePort      value: 25Resources:    AWSEBLoadBalancer:        Type: AWS::ElasticLoadBalancing::LoadBalancer        Properties:            Listeners:                - InstancePort: 25                  LoadBalancerPort: 80                  Protocol: TCP                - InstancePort: 25                  LoadBalancerPort: 25                  Protocol: TCP            AvailabilityZones:                - us-west-2a                  us-west-2b                  us-west-2c            HealthCheck:                Timeout: 5                Target: TCP:25                Interval: 30                HealthyThreshold: 3                UnhealthyThreshold: 5

This file is in YAML format and hence indentation is important.The option setting ('aws:cloudformation:template:parameter', 'InstancePort') sets the instance port to 25 and also modifies the security group to make sure that port 25 is accessible by the load balancer.

This file is overriding the default Load Balancer Resource created by Elastic Beanstalk with two listeners both having instance port set to 25. Hope that helps.

Read more about customizing your environment with ebextensions here.Can you try creating a new environment with the above file in .ebextensions/01-elb.config file in the appsource directory? Let me know if you run into any issues.