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

  • EC2 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

  1. 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.

  2. 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.

  3. 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.
  4. Configure the Load Balancer to store Access logs in S3 bucket. Choose the ELB and from Actions drop-down menu choose Edit attributeslab68_elblogs
  5. Test log storing by browsing to the ELS DNSlab68_response
  6. The logs are successfully saved in the bucket

    lab68_s3logs


    Lab files

Acknowledgements

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *