Name : SG-EFS-LabASG
Inbound Rules :
- NFS : Custom (SG-WebServerASG)
Outbound Rules :
- All Trafic : Anywhere (IPv4)
Create and Configure AWS EFS
Search and Create EFS Service
Name : EFS-LabASG
"Customize"
##On the 1st slide, immediately click "Next"##
##Delete sg-default then change it to SG-EFSLabASG do it in all AZ##
Security Groups : SG-EFSLabASG
Get EFS mount script
Attach
Copy & paste attach script to notepad
##Using the EFS mount helper:##
sudo mount -t efs -o tls fs-012f18432a9d388f8:/ efs
##Using the NFS client:##
sudo mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport fs-012f18432a9d388f8.efs.us-east-1.amazonaws.com:/ efs
Create a New EC2
Name : EC2-For-ASG(Ubuntu)
OS : Ubuntu22.04 (t2.small)
Keypair : vockey
Security Group : Select exiting security group "SG-WebServerASG"
Storage : 10GB
Instance> Action> Image and Templates> Create Image
Image Name : AMI-For-WebServer-ASG
Image Description : Ready installed apache2, PHP, efs-utils, git, and python3
"Create"
Create Launch Template
Launch Template Name : LT-WebServerASG
Template version description : A template for running ASG aplication
My AMI :
#Owned by me : AMI-For-WebServer-ASG
Keypair : vockey
Security Group :
#Selecting exiting security group : SG-WebServerASG
#Advance Detail#
#**Script for User Data**#
#!/bin/bash
sudo mount -t efs -o <efs-address>:/ /var/www/html
sudo git clone https://github.com/abdullahalfz18/default-apache2-on-ubuntu.git /var/www/html
sudo systemctl restart apache2
<efs-address> = fs-012f18432a9d388f8
Create new Target Group
Target group name : TG-For-ELBLabASG
#Advanced Healt Setting#
Healt check point : Traffic port
Healty threshold : 2
Unhealty threshold : 2
Timeout : 2
Interval : 5
Create new Elastic Load Balancer (ELB)
Load Balancer Type : Aplication Load Balancer
Load Balancer name : ELB-LabASG
Mappings : Checklist for all availability zone
Security Group : SG-WebServerASG
Listener and Routing : TG-For-ELBLabASG
Copy and save DNS ELB : ELB-LabASG-699876940.us-east-1.elb.amazonaws.com
Create new Autoscalling Group (ASG)
Auto Scalling Group Name : ASG-WebServerLab
Launch Template : LT-WebServerASG
Availability Zone & Subnet : Checklist for all availability zone
Load Balancing : Attach to an exiting load balancer
Attach to an exiting load balancer : Choose from your load balancer target groups
Exiting load balancer target groups : TG-For-ELBLabASG
â Turn on elastic load balancing health check
Desired Capacity : 2
Minimun Capacity : 2
Maximum Capacity : 4
Add Tags:
Key : Name
Value : EC2-WebServerASG