This lab walks you through the steps of creating Application Load Balancer for two Instances with Apache server on them. The ELB will create Access logs into a S3 bucket.
Services Covered
Amazon EC2
Lab description
This lab walks you through the steps of creating Application Load Balancer for two Instances with Apache server on them. The ELB will create Access logs into a S3 bucket.
Lab date
24-10-2021
Prerequisites
- AWS account
Lab steps
- Launch an Ec2 Instance of type Amazon Linux 2 t2.micro. Set up the user data to display a simple response:
#!/bin/bash sudo su yum update -y yum install -y httpd systemctl start httpd systemctl enable httpd echo "Response coming from server A" > /var/www/html/index.html
For Security Group options allow inbound traffic for HTTP.
- Launch similar Instance with slightly changed response
#!/bin/bash sudo su yum update -y yum install -y httpd systemctl start httpd systemctl enable httpd echo "Response coming from server B" > /var/www/html/index.html
Use the same Security Group as for the first one.
- Create a Application Load Balancer with Internet-facing scheme and of IPv4 type. Choose the same Security Group as for instances. Create a ne Target Group of type Instances and provide it in Listeners and routing for HTTP.
- Configure the Load Balancer to store Access logs in S3 bucket. Choose the ELB and from Actions drop-down menu choose Edit attributes
- Test log storing by browsing to the ELS DNS
- The logs are successfully saved in the bucket
Lab files