0

I have a CloudFormation Template that defines an Elastic Beanstalk Application.

I want to extend this application, i.e. I want the listener at port 80 to redirect to HTTPS. The AWS::ElasticBeanstalk::Environment properties do not allow for this configuration options: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/command-options-general.html

All I can find tells me to add the Listener resource configuration in the .ebextensions, but I have no idea how to integrate this .ebextensions with the CloudFormation Template.

I have tried using the .ebextensions folder as usual but that's no good. I also tried integrating the resource directly in the same template, but I have no way of getting the ARN I need from the EB setup, since it is not exported from the stack or exposed by the resource. I even gave up and tried setting up a shared application load balancer, but it is way more complex and not really solving my issue.

I tried Redirect HTTP to HTTPS for Application Loadbalancer in Elastic Beanstalk in Cloudformation and the pointer at https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/environment-resources.html but none of it indicates how to integrate that with a main CloudFormation Template.

I'm really lost here.

ed__
  • 125
  • 5

1 Answers1

0

I went for a different solution. I created my own lambda and custom resource that modifies the load balancer directly in code:

Just define a lambda that begins with the EB environment name, then from there use the API to find the target group and listeners.

You can do stuff like setup target group health check path or listener redirects.

Not a "nice" solution but maybe one can use the registry to define a custom resource to simplify configuration options like these without having to jump straight to a shared load balancer setup.

ed__
  • 125
  • 5