I'm trying to automate the configuration of my Elastic Beanstalk application using Saved Configs.
Does anyone have an example of how to get the application load balancer created from Elastic Beanstalk to use a different health check port?
If not, is there a way to access the underlying resource so that I can apply a custom HealthCheckPort: 8081
to the Target Group?
Details and Attempts To-Date:
The application is a simple DropWizard based Java application, which provides HTTP APIs on port 8080, and a health check API on port 8081.
I've had success configuring the environment using a Classic ELB via the following OptionSettings:
OptionSettings:
aws:elasticbeanstalk:environment:
EnvironmentType: LoadBalanced
LoadBalancerType: classic
aws:elasticbeanstalk:application:
Application Healthcheck URL: HTTP:8081/healthcheck
aws:elasticbeanstalk:environment:process:default:
MatcherHTTPCode: '200'
Port: '8080'
Protocol: HTTP
aws:elb:healthcheck:
HealthyThreshold: '3'
Interval: '10'
Timeout: '5'
UnhealthyThreshold: '5'
aws:elb:listener:80:
ListenerProtocol: HTTP
InstancePort: '8080'
InstanceProtocol: HTTP
ListenerEnabled: true
aws:elb:loadbalancer:
CrossZone: true
However, when I update the config to use an Application ELB, the health check associated with the target group is set to the application port (8080) and not the health check port (8081). This causes the application to start into a failed state, which can only be corrected by manually changing the Target Group health check port.
OptionSettings:
aws:elasticbeanstalk:environment:
EnvironmentType: LoadBalanced
LoadBalancerType: application
aws:elasticbeanstalk:application:
Application Healthcheck URL: HTTP:8081/healthcheck
aws:elasticbeanstalk:environment:process:default:
MatcherHTTPCode: '200'
Port: '8080'
Protocol: HTTP
aws:elbv2:listener:default:
DefaultProcess: default
ListenerEnabled: true
Protocol: HTTP
aws:elbv2:loadbalancer:
AccessLogsS3Enabled: false
IdleTimeout: '60'
I cannot find any other relevant fields in the AWS Elastic Beanstalk command options documentation.
I've also thought about doing custom resource modifications, but the only ELB referenced is AWSEBLoadBalancer
of type AWS::ElasticLoadBalancing::LoadBalancer
which is a classic load balancer, but the modification I need to make are in type AWS::ElasticLoadBalancingV2::TargetGroup
for application load balancer.