More Info:
Ensure that HTTPS is enabled for the load balancer associated with your Amazon Elastic Beanstalk application environment in order to handle encrypted web traffic. By default, the load balancer handles unencrypted traffic requests (HTTP) through port 80. To enable HTTPS traffic over port 443, you must create and configure an HTTPS listener for the associated load balancer.Risk Level
HighAddress
SecurityCompliance Standards
SOC2,GDPR,PCIDSS,NIST,HITRUST,NISTCSFRemediation
How to ensure that HTTPS is enabled for EC2 ElasticBeanstalk Load BalancerUsing AWS Console
- Log in to the AWS Management Console using your AWS account credentials.
- Navigate to the Elastic Beanstalk service by selecting “Elastic Beanstalk” from the services menu.
- In the Elastic Beanstalk dashboard, select the appropriate environment that you want to configure for HTTPS.
- In the environment details page, click on the “Configuration” tab in the left navigation pane.
- Scroll down to the “Load Balancer” section and click on the “Edit” button next to “Load balancer settings”.
- In the “Secure listener port” field, ensure that the value is set to 443. This is the default port for HTTPS.
- In the “SSL certificate ID” field, select or upload the appropriate SSL certificate for your domain. If you haven’t already uploaded the SSL certificate to AWS Certificate Manager (ACM), you can do so by clicking on the “Upload” button and following the instructions.
- Optionally, you can choose to enable “HTTP to HTTPS redirection” by checking the box next to it. This will automatically redirect HTTP traffic to HTTPS.
- Click on the “Apply” button to save the changes and update the environment configuration.
- Wait for the environment update to complete. This may take a few minutes.
- Once the update is complete, your Elastic Beanstalk environment’s load balancer should be configured to use HTTPS.
- Test the HTTPS connectivity by accessing your application using the HTTPS protocol (e.g., https://your-domain.com). Ensure that the SSL certificate is valid and the connection is secure.
Triage and Remediation
- Remediation
Remediation
Using Console
Using Console
Below are console-only steps to enforce HTTPS for an Elastic Beanstalk (EC2) environment load balancer.
1. Get/Validate an SSL Certificate in ACM
- Go to AWS Management Console → Certificate Manager (ACM).
- Choose Request a certificate → Request a public certificate.
- Enter your domain(s), e.g.
example.comandwww.example.com. - Choose validation method:
- DNS validation (recommended): ACM gives you CNAME records to add to your DNS (e.g., Route 53 or external).
- Or Email validation if DNS isn’t an option.
- Complete validation. Wait until status is Issued.
2. Confirm Your EB Environment Uses a Load Balancer
- Go to Elastic Beanstalk → select your Application → select your Environment.
- In the Environment overview, check the Environment type:
- Must be Load balanced (either ALB or Classic ELB).
- If it’s Single instance, you’ll need to create a new Load balanced environment (you can clone config).
3. Attach the SSL Certificate & Add HTTPS Listener
For an Application Load Balancer (ALB) environment (most newer EB envs)
- In your environment page, choose Configuration from the left menu.
- Under Load balancer, click Edit.
- Look at the Listeners section:
- You should see a listener on Port 80, Protocol HTTP.
- Add HTTPS listener:
- Click Add listener (or equivalent).
- Set:
- Port:
443 - Protocol:
HTTPS
- Port:
- Under SSL certificate, choose:
- Choose from ACM → select the certificate you created (ARN).
- Under Default rules / Target group, select the existing target group that your HTTP listener uses (so 443 forwards to the same instances/targets as 80).
- Save the configuration (e.g., Apply or Save on the page).
- Wait for Elastic Beanstalk to update the environment.
For a Classic Load Balancer environment (older EB envs)
- From your EB environment Configuration page → under Load balancer, click Edit.
- Under Listeners, check existing:
- You should see a listener
HTTP : 80 → HTTP : 80(front-end to back-end).
- You should see a listener
- Add HTTPS listener:
- Add a new listener with:
- Load Balancer Protocol:
HTTPS - Load Balancer Port:
443 - Instance Protocol:
HTTP - Instance Port:
80
- Load Balancer Protocol:
- For SSL Certificate, select your ACM certificate.
- Add a new listener with:
- Save and let EB update the environment.
4. Redirect HTTP (80) to HTTPS (443)
You’ve now enabled HTTPS, but you should force redirect all HTTP traffic to HTTPS.Option A – At application level (simplest, recommended)
Redirect in your app code / web server configuration:-
For a typical Node.js / Express app, add middleware:
-
For Apache (PHP, etc.) in
.htaccess: -
For Nginx in a config file in
.ebextensions(if you control Nginx):.ebextensions/https-redirect.config:
Option B – ALB listener rule (if using ALB)
- From the environment’s Configuration → Load balancer → find the HTTP:80 listener.
- Open View rules or Edit rules for the HTTP listener.
- Add a rule before the default:
- Condition:
If(e.g.,Pathis/or/*– or no condition if you want all). - Action: Redirect:
- Protocol:
HTTPS - Port:
443 - Status code:
HTTP_301.
- Protocol:
- Condition:
- Save the rules.
5. Test
- Browse to:
http://your-domain.com. - Confirm:
- It redirects to
https://your-domain.com. - The browser shows a valid padlock/secure connection.
- It redirects to
- Also test direct
https://your-domain.com.
Using CLI
Using CLI
Below are concise, CLI‑only steps to enforce HTTPS on an Elastic Beanstalk environment fronted by an Elastic Load Balancer (ALB / CLB) on EC2.
Verify:
Request a public certificate (DNS validation):Note the
Or simply:Look inside for:
Replace:Apply to the environment:Wait for the environment to finish updating, then test:
If HTTPS already exists, you can update the cert:
Allow HTTPS from the internet:Optionally remove HTTP (80) if you’re not using it:
If you tell me whether your EB environment is using ALB or Classic ELB, I can trim this down to only the exact commands you need.
1. Get your environment & region info
2. Get / create an ACM certificate
CertificateArn from the output. Wait until its status is ISSUED:3. Identify whether your EB environment uses ALB or Classic ELB
aws:elasticbeanstalk:environment→LoadBalancerType = application→ ALB- Or no such setting / default → usually Classic.
4A. For ALB (recommended): enforce HTTPS + redirect HTTP
Use Elastic Beanstalk option settings to:- Configure HTTPS listener (443) with your ACM certificate
- Keep HTTP (80) but redirect it to HTTPS
alb-https-config.json:http://app.example.com→ should 301 redirect tohttps://app.example.comhttps://app.example.com→ should work with a valid cert
4B. For Classic Load Balancer: HTTPS listener + (optional) HTTP→HTTPS
4B.1 Get the underlying ELB name
From EB:4B.2 Create/modify HTTPS listener on Classic ELB
Add HTTPS (443) listener using your ACM cert (same region):4B.3 (Optional but recommended) Redirect HTTP→HTTPS at the app
Classic ELB does not support redirect rules; so either:- Keep port 80 listener and configure your app/web server to redirect to HTTPS, or
- Remove the HTTP listener (forcing HTTPS only):
5. Confirm security group allows 443 and (optionally) restricts 80
Get the LB’s security group(s):If you tell me whether your EB environment is using ALB or Classic ELB, I can trim this down to only the exact commands you need.
Using Python
Using Python
Below are practical, step‑by‑step instructions to enforce HTTPS for an Elastic Beanstalk environment (EC2) and a minimal Python (boto3) example to apply it programmatically.
Option A – Configuration files (
For ALB (most modern EB environments):
CreateThen add an HTTP→HTTPS redirect via ALB rules. For EB’s new ALB model, use a platform hook:Create Make it executable:Deploy the app (
Run this from a machine/CI with:
If you tell me your environment type (ALB vs Classic) and platform (e.g., Python 3.12 on AL2), I can adjust the config snippets exactly to that.
1. Prerequisites
- Elastic Beanstalk environment already running (Web Server, EC2).
- Application Load Balancer (ALB) or Classic ELB created by EB.
- ACM certificate in the same region as your Beanstalk environment:
- Request via console: ACM → Request a certificate → Public → add domain → validate.
- Note the certificate ARN, e.g.:
2. Enforce HTTPS via Elastic Beanstalk configuration
Option A – Configuration files (.ebextensions / .platform)
For ALB (most modern EB environments):Create
.ebextensions/https-alb.config in your app root:.platform/hooks/postdeploy/01-redirect-http-to-https.sh:eb deploy); EB will:- Enable HTTPS listener 443 with your cert.
- Keep HTTP listener 80 only for redirection.
- Install redirect rule via the hook script.
3. Python (boto3) – Programmatically enforce HTTPS
Below is an example to:- Find the ALB used by your EB environment.
- Ensure HTTPS listener (443) exists with your ACM cert.
- Modify HTTP (80) listener to always redirect to HTTPS.
- IAM permissions for
elasticbeanstalk:*,elasticloadbalancingv2:*,acm:ListCertificates(or at least describe/modify for ALB and EB). - Credentials configured (env vars,
~/.aws/credentials, or instance role).
4. Security group check (optional but recommended)
Ensure the load balancer security group:- Allows inbound 80/tcp (only if you need redirect) and 443/tcp from the internet.
- Your EC2 instances’ security group allows inbound from the LB SG on port 80 (if your app listens on 80).
If you tell me your environment type (ALB vs Classic) and platform (e.g., Python 3.12 on AL2), I can adjust the config snippets exactly to that.
Using Terraform
Using Terraform
terraform plan should show:- creation (or update) of an HTTP listener on port 80 whose
default_actionis aredirectto HTTPS on port 443 with statusHTTP_301. - creation (or confirmation) of an HTTPS listener on port 443 with a valid
certificate_arnthat forwards to your target group.

