Skip to content

HTTPS for ElasticBeanstalk

0

I want to create a CLI script that creates a fresh new ElasticBeanstalk environment from scratch. Such an environment would get an AWS domain name assigned under which I can access the PHP scripts that I deploy into that environment. That works immediately but only with HTTP. Subsequently I want to switch the environment to use HTTPS. I want to do it with the script as well so that it is immediately ready to work. Now I am stuck with the task how to solve the problem with the certificate for the AWS domain that the environment gets. AWS does not allow creating and using a certificate for that domain. I do not want to use my own DNS or any other domain because routing DNS to the EBT domain will take a longer time. I just want to create a certificate somewhere automatically by the script and assign it to the EBT default domain name so that the moment this gets created I can direct my browser anywhere on the world to the newly created EBT environment doing https://<ebt domain name> and I get a response from my PHP script deployed in EBT. I don't want to use ElasticIP, additional load balancers or accelerators and all that unnecessarily complex and expensive stuff. I just want the simplest possible variant - just the domain name of the environment that it gets assigned by Amazon but over HTTPS, created instantly with a CLI script.

How can I do that?

Thanks.

1 Answer
1
Accepted Answer

I apologize, but I'm afraid what you're asking for is not possible in the way you've described. There are several reasons for this:

  1. AWS Elastic Beanstalk environments by default use a subdomain of elasticbeanstalk.com. These domains are managed by AWS and you cannot obtain a valid SSL/TLS certificate for a domain you don't own or control.

  2. To use HTTPS, you need a valid SSL/TLS certificate. These certificates are domain-validated, which means the certificate authority needs to verify that you control the domain. This is not possible with the default Elastic Beanstalk domain.

  3. While you can use a self-signed certificate for development and testing purposes, these are not trusted by browsers and will show security warnings to users.

  4. The simplest way to set up HTTPS for an Elastic Beanstalk environment is to use a custom domain that you own, obtain an SSL certificate for it (which you can do easily and for free using AWS Certificate Manager), and then configure your Elastic Beanstalk environment to use this certificate.

  5. The process of setting up HTTPS involves several steps that can't be fully automated in the way you're describing, especially not "instantly" or without some form of DNS configuration.

If you want to set up HTTPS for your Elastic Beanstalk environment, you'll need to:

  1. Register a custom domain name.
  2. Obtain an SSL certificate for this domain (you can use AWS Certificate Manager for this).
  3. Configure your Elastic Beanstalk environment to use HTTPS, which typically involves setting up a load balancer.
  4. Point your custom domain to your Elastic Beanstalk environment's URL.

While much of this can be automated with scripts, it can't be done instantly or without owning a domain. The requirement for domain validation in the SSL certificate process makes it impossible to create a valid, trusted HTTPS setup for a domain you don't control.
Sources
Configuring HTTPS for your Elastic Beanstalk environment - AWS Elastic Beanstalk
Your Elastic Beanstalk environment's Domain name - AWS Elastic Beanstalk

answered 2 years ago

EXPERT

reviewed 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.