Use the Application Load Balancer to make redundant EC2

Use the Application Load Balancer to create a redundant EC2.

Terraform Code(Github)

Environment

  • VPC
  • Two public subnets.
  • Two EC2 instances
  • ELB (Application Load Balancer)

EC2

  • OS: Ubuntu 18.04
  • Install Nginx on your EC2 so that you can access it via http://.
  • You can access the site via SSH.
    • The public key file for SSH access is specified with the variable “pubkey_file_path”.
  • Install and start Nginx with the user data.

ELB

  • Creates an Application Load Balancer.
  • It supports HTTP and HTTPS.
  • A server certificate is required for HTTPS communication. Please prepare for this by referring to the procedure for issuing a certificate in ACM.
  • Save the ELB access log to the S3 bucket.