Adding HTTPS to Your AWS Beanstalk App
You've deployed your application to AWS Elastic Beanstalk, but it's currently only accessible via HTTP. This guide will help you secure your app and enable HTTPS on your domain.
Why HTTPS Matters
HTTPS (Hyper Text Transfer Protocol Secure) is the secure version of HTTP. It provides encryption and data integrity for your website. This ensures that information exchanged between users and your site is encrypted, protecting against security threats such as data breaches and man-in-the-middle attacks.
Having your site accessible through HTTPS enhances security and builds trust with users, as they feel safer interacting with your app.
Steps to Enable HTTPS for Your AWS Beanstalk App
Step 1: Obtain an SSL Certificate
To enable HTTPS for your domain, you need an SSL (Secure Sockets Layer) certificate. AWS offers a simple method to obtain and manage SSL certificates through AWS Certificate Manager (ACM).
-
Navigate to AWS Certificate Manager (ACM):
- Go to the AWS Certificate Manager Console.
-
Request a Public Certificate:
- Click on "Request a certificate".
- Select "Request a public certificate".
- Enter your domain name (e.g.,
example.com
and*.example.com
for a wildcard certificate). - Complete the request using DNS validation.
Step 2: Configure HTTPS in AWS Beanstalk
-
Open Elastic Beanstalk Console:
- Access the Elastic Beanstalk Console.
-
Select Your Environment:
- Choose the environment you want to configure for HTTPS.
-
Modify Environment Configuration:
- Click on "Configuration" in the left-hand menu.
- Under the "Load balancer" category, select "Edit".
-
Add HTTPS Listener:
- In the "Listeners" section, add an HTTPS listener on port 443.
- For "SSL certificate", choose the certificate you obtained from ACM.
-
Save Changes:
- Apply the changes and wait for the environment to update.
Step 3: Update Security Groups for HTTPS
Ensure your security group settings allow inbound HTTPS traffic:
-
Navigate to the EC2 Console:
- Access the EC2 Console.
-
Select Security Groups:
- Find the security group associated with your Elastic Beanstalk environment.
-
Edit Inbound Rules:
- Add a new rule to allow HTTPS traffic:
- Type: HTTPS
- Protocol: TCP
- Port Range: 443
- Source: Anywhere (0.0.0.0/0) or specify a more restricted IP range if needed.
- Add a new rule to allow HTTPS traffic:
-
Save the Rules.
Step 4: Update DNS Settings
Point your domain to your Elastic Beanstalk environment:
-
Get Your Elastic Beanstalk Environment URL:
- Note the URL of your Elastic Beanstalk environment (e.g.,
my-app-env.elasticbeanstalk.com
).
- Note the URL of your Elastic Beanstalk environment (e.g.,
-
Log in to Your DNS Provider:
- Access the DNS management console of your domain registrar (e.g., GoDaddy, Namecheap, Cloudflare).
-
Create a CNAME Record:
- Create a new CNAME record pointing to your Elastic Beanstalk environment URL.
- Example:
- Name:
www
(or@
for the root domain if your provider allows) - Type:
CNAME
- Value:
my-app-env.elasticbeanstalk.com
- Name:
-
Save the DNS Record and wait for propagation.
Step 5: Validate HTTPS Setup
After applying the changes, access your application using HTTPS. Verify that your website loads correctly without security warnings or errors. You can use online tools like SSL Labs to check the SSL configuration.
Securing your AWS Beanstalk app with HTTPS is an important step for enhancing your web presence. Following these steps will help you provide a secure browsing experience for your users.
(Edited on September 4, 2024)