In this recipe, we will configure TLS on an Amazon Linux 2 EC2 instance to enable HTTPS access to our web server.
Enabling HTTPS on an EC2 instance
Getting ready
We need to follow the Using EC2 user data to launch an instance with a web server recipe in Chapter 6, Working with EC2 Instances, in order to set up an EC2 instance. You will also need the following:
- The security group should allow HTTP (80) and HTTPS (443) for everyone, and SSH (22) for our local IP.
- Apache web server should be installed and configured to start on system reboot. You can verify that your Apache server is enabled by SSHing into the EC2 instance and running the sudo systemctl is-enabled httpd command. This should return enabled.