Lesson1 – text
# These scripts are used to launch the two target groups. In each target group there are EC2 instance that will be used as the backend behind the ALB.
# Each instance is tested from the Internet before launching the ALB. So the instance should:
# 1- Be in a public subnet. In real production scenarios, they can be in either public or private subnets since the Internet facing ALB will be enabled in public subnets.
# 2-Use a default security group that allow traffic from the Internet.
# 3-Have pbulic IP (or elastic IP).
###############################
# Start Copying script from the next line…
#!bin/bash
# To run bash shell
# Script 1: For The target T1 in TG1.
yum update -y
# To update yum with yes option
yum install httpd -y
# To install Apache server
systemctl start httpd service
# To start Apache server
systemctl enable httpd
# To keep Apache server running in after each booting
echo “The target, T1, is registered in the target group TG1, which is located in Availability Zone AZ1 (US-East-1a) within the AWS Region US-EAST-1 (North Virginia). Requests are Forwarded to this target group by the listener, following Rule1 (Default rule).” > /var/www/html/index.html
###############################
# Start Copying script from the next line…
#!bin/bash
# To run bash shell
# Script 2: For The target T2 in TG1.
yum update -y
# To update yum with yes option
yum install httpd -y
# To install Apache server
systemctl start httpd service
# To start Apache server
systemctl enable httpd
# To keep Aapache server running in after each booting
echo “The target, T2, is registered in the target group TG1, which is located in Availability Zone AZ2 (US-East-1b) within the AWS Region US-EAST-1 (North Virginia). Requests are Forwarded to this target group by the listener, following Rule1 (Default rule).” > /var/www/html/index.html
###############################
# Start Copying script from the next line…
#!bin/bash
# To run bash shell
# Script 3: For The target T1 in TG2.
yum update -y
# To update yum with yes option
yum install httpd -y
# To install Apache server
systemctl start httpd service
# To start Apache server
systemctl enable httpd
# To keep Apache server running in after each booting
mkdir /var/www/html/courses
# To create a path for courses
echo “The target, T1, is registered in the target group TG2, which is located in Availability Zone AZ1 (US-East-1a) within the AWS Region US-EAST-1 (North Virginia). Requests are Forwarded to this target group by the listener, following Rule2.” > /var/www/html/courses/index.html
###############################
# Start Copying script from the next line…
#!bin/bash
# To run bash shell
# Script 4: For The target T2 in TG2.
yum update -y
# To update yum with yes option
yum install httpd -y
# To install Apache server
systemctl start httpd service
# To start Apache server
systemctl enable httpd
# To keep Apache server running in after each booting
mkdir /var/www/html/courses
# To create a path for courses
echo “The target, T2, is registered in the target group TG2, which is located in Availability Zone AZ2 (US-East-1b) within the AWS Region US-EAST-1 (North Virginia). Requests are Forwarded to this target group by the listener, following Rule2.” > /var/www/html/courses/index.html
###############################
# Start Copying script from the next line…
#!bin/bash
# To run bash shell
# Script 5: For The target T1 in TG3.
yum update -y
# To update yum with yes option
yum install httpd -y
# To install Apache server
systemctl start httpd service
# To start Apache server
systemctl enable httpd
# To keep Apache server running in after each booting
mkdir /var/www/html/bootcamps
# To create a path for courses
echo “The target, T1, is registered in the target group TG3, which is located in Availability Zone AZ1 (US-East-1a) within the AWS Region US-EAST-1 (North Virginia). Requests are Forwarded to this target group by the listener, following Rule2.” > /var/www/html/bootcamps/index.html
###############################
# Start Copying script from the next line…
#!bin/bash
# To run bash shell
# Script 6: For The target T2 in TG3.
yum update -y
# To update yum with yes option
yum install httpd -y
# To install Apache server
systemctl start httpd service
# To start Apache server
systemctl enable httpd
# To keep Apache server running in after each booting
mkdir /var/www/html/courses
# To create a path for courses
echo “The target, T2, is registered in the target group TG3, which is located in Availability Zone AZ2 (US-East-1b) within the AWS Region US-EAST-1 (North Virginia). Requests are Forwarded to this target group by the listener, following Rule2.” > /var/www/html/bootcamps/index.html