======== AWS EC2 ======== => Elastic Compute Cloud => It is Most demanded service in AWS => It is Used to create Virtual Machines in AWS cloud => EC2 VM is called as EC2 instance EC2 Instance = Computer / Server / VM / Virtual Machine / V Box => EC2 instance is re-sizable (we can change configuration based on demand) => EC2 is a paid service (hourly billing) => EC2 VM Minimum billing period is 1 hour 9:00 AM to 9:15 AM => 15 mins => 1 hour billing 9:30 AM to 9:45 AM => 15 mins => 1 hour billing Note: To encourage beginners, AWS provided t2.micro/t3.micro for 1 year free (monthly 750 hours) ==================== EC2 Instance Types ==================== => Amazon EC2 (Elastic Compute Cloud) offers a variety of instance types to suit different use cases. 1) General Purpose - T series : t2, t3, t4... - M series : m6g, m5, m5a, m5n... 2) Compute Optimized - C series : c7gm c6i, c6g, c5, c5a 3) Memory Optimized - R series : r6g, r5, r5a, r5n - X series : x2gd, x1e 4) Storage Optimized - I series : i4i, i3, i3en - D series : d2 5) Accelarated Computing - P series : p4, p3, p2 - G series : g5, g4ad, g4dn - inf series : inf1 6) High Performance Computing - H series : hpc6id =================== Creating EC2 VM =================== => To create EC2 instance we will use below components 1) AMI 2) Instance type 3) keypair 4) VPC 5) Security Group 6) EBS Volume => AMI represents operating system like Windows, Linux, MAC etc... => Instance Type represents machine configuration Ex : t2.micro, t3.micro, t2.medium, t2.large etc.... => Keypair is used to connect with EC2 VM securely Ex: .pem file => VPC provides network required for the EC2 vm => Security Group represents inbound and outbound rules. => EBS Volume represents storage required for EC2 instance. Ec2 VM with Windows OS : 30 GB (default) EC2 VM with Linux OS : 8 GB (default) EBS max capacity : 16 TB (16000 GB) Note-1 : One Key Pair we can use for multiple EC2 instances Note-2 : One Security Group (SG) we can use for multiple EC2 instances. =============================== Types of IP's in AWS Cloud =============================== => We have 3 types of IP's in AWS cloud 1) private ip 2) public ip 3) Elastic IP => Private IP is a fixed IP in AWS. It is used for internal communication (With in VPC). => Even if we restart the EC2 instance, private IP will not change. => public ip is a dynamic IP in aws. It is used to connect with EC2 VM from outside. => When we restart our EC2 instance then public ip gets changed. => If we want fixed public ip then we need to use Elastic IP. => Elastic IPs are commercial (bill will be generated). ===================================================================================== Assignment : Create EC2 VM with Windows AMI and connect with that using RDP client. ===================================================================================== ================================= What is user-data in EC2 VM ? ================================= - It is used to execute script while launching ec2 machine. - User data will execute only once - Create EC2 VM (amazon linux) with below user data #! /bin/bash sudo su yum install httpd -y cd /var/www/html echo "

Life Insurance Server - 1

" > index.html service httpd start ======================== What is Load Balancer ? ======================== => When we run our application in single server then we have to face below challenges 1) One server should handle all reqs 2) Burden will increase on server 3) Response will be delayed for clients 4) Server can crash 5) Single Point Of Failure => To avoid above problems, we will run our application in multiple servers. => We will use Load Balancer to distribute load to all servers in the round robbin fashion. => We have below advantages with Load Balancer 1) App will run in multiple severs 2) Load will be distributed 3) Burden will be reduces on servers 4) Fast Performance 5) High Availability => In AWS we have 4 types of Load Balancers 1) Application Load Balancer (ALB) 2) Network Load Balancer (NLB) 3) Gateway Load Balancer (GLB) 4) Classic Load Balancer (previous generation) ========================= Load Balancer Lab Task ========================= Step-1) Create EC2 VM-1 with below user data #! /bin/bash sudo su yum install httpd -y cd /var/www/html echo "

Life Insurance Server - 1

" > index.html service httpd start Step-2) Create EC2 VM-2 with below user data #! /bin/bash sudo su yum install httpd -y cd /var/www/html echo "

Life Insurance Server - 2

" > index.html service httpd start Step-3) Add these 2 instances to one "Target Group" Step-4) Create Load Balancer with Target Group (ALB) Step-5) Access Load Balancer DNS in browser ============ Assignment ============ ##### Microservices Load Balancing with multiple Target Groups : https://www.youtube.com/watch?v=QvEJ8--zneU #### =============== Auto Scaling =============== => It is used to adjust the capacity required to handle the load of our application. Ex: For big billon day sale we can't guess traffic => If requests are increasing then servers should be increased and if requests are decreasing then servers should be reduced. => If we use Auto scaling then it will increase or decrease the no.of servers based on incoming traffic. => We have below advantages with Auto Scaling 1) Cost Management 2) High Availability 3) Fault Tolerance ============== What is EBS ============== => EBS stands for Elastic Block Store => It is block level storage device (Hard Disc / SSD) => When we create ec2 instance then "EBS Volume" gets created automatically. Note: If we remove EBS volume from EC2 instance then we can't start/use that EC2 instance. => In EBS we have 2 types of volumes (storages) 1) Root Volume 2) Additional Volume Ntoe: When we launch EC2 instance by default we will get one Root volume. => Root volume is mandatory to launch EC2 instance. => Additional EBS volumes are optional devices (we can add/remove) => For windows VM, we will get 30 GB as default volume size. => For Linux VM, we will get 8 GB as default volume size. Note: EBS volume can have upto 16 TB (16000 GB) => One EC2 VM can have multiple EBS volumes. => One EBS volume can be attached to one EC2 VM at a time. => EBS volumes are Availability Zone Specific Mumbai : ap-south-1 ap-south-1a ap-south-1b ap-south-1c Note: In which availability zone our EC2 VM got created, in same availability zone we have to create EBS volumes for attaching. ========== Snapshots ========== => Snapshots are used for volumes backup => snapshots are region specific => From Volume we can create snapshot and from snapshot we can create volume volume =====> snapshot ========> volume => Snapshot can't be attached to EC2 instance directley (volumes can be attached to ec2 instances directley). ========================================================= Q) How to copy the data from 1a zone VM to 1b zone VM ? ========================================================= Step-1 : Create snapshot for 1a VM volume Step-2 : From snapshot create volume in 1b zone Step-3 : Attached newly created 1b volume to 1b VM. ================= EBS Volume Types ================= => We have 5 types of EBS volumes 1) General Purpose Volume (Min: 1 GiB, Max: 16384 GiB) 2) Provisioned IOPS (io1) (Min: 4 GiB, Max: 16384 GiB) 3) Cold HDD (Min: 125 GiB, Max: 16384 GiB) 4) Throuput Optimized (Min: 125 GiB, Max: 16384 GiB) 5) Magnetic (standard) (Min: 1 GiB, Max: 1024 GiB) =========================================== 1) What is EC2 & Why 2) What is AMI 3) What is Key Pair 4) What is Security Group 5) Launch Windows VM and connect with RDP client 6) Launch Linux VM and connect with SSH Client 7) What is User Data 8) Types of IPs 9) Launching Static website using HTTPD webserver 10) EBS Volumes & Snaphosts 11) Load Balancers 12) OSI Model 13) Auto Scaling Group