How to Deploy EC2 Instances in Multiple AZs, with a Load Balancer, and SSL Certificate in AWS with Terraform
In this story, we will learn how to build several components to create a good foundation base to deploy high available web applications in AWS.
We will deploy:
- Amazon Linux EC2 Instances in multiple AZs
- An Application Load Balancer (ALB) to distribute the load between these EC2
- ALB Target Group and Listeners for HTTP and HTTPS protocols
- Register DNS Records in Route 53
- Create an SSL certificate using AWS Certificate Manager
If you are interested in deploying similar workloads for internal applications (not accessible from the internet), please look at this story → How to Deploy EC2 Instances with an Internal Load Balancer, and ACM SSL Certificate in AWS with Terraform.
Prerequisite #1: AWS Credentials
Before creating our AWS EC2 Instance, we will need AWS Credentials to execute our Terraform code.
The AWS provider offers a few options for providing credentials for authentication:
- Static credentials
- Environment variables
- Shared…