forked from maulik2311/Linux-by-Kastro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDay 19- AWS Training - B9_CIVIL Edu.txt
93 lines (69 loc) · 2.68 KB
/
Day 19- AWS Training - B9_CIVIL Edu.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#####################################################################################
Day 18
#####################################################################################
======================
ALB - Demo
======================
***************************************************
Demo 3 – Application Load Balancer
***************************************************
1. Create Launch Template with user data
2. Create Auto Scaling Groups
3. Create Load Balancer (ALB)
LT Name: 04AprilB9-LT
SG Name: 04AprilB9-SG
ASG Name: 04AprilB9-ASG
ALB Name: 04AprilB9-ALB
TG Name: 04AprilB9-TG
Desired : 2
Minimum : 2
Maximum : 5
Sticky Sessions:
If you want to divert the traffic to only one instance using LB, in such cases we will use Sticky Sessions.
Stickiness is of 2 types:
1. Load balancer generate cookie - It is generated by LB, Based on duration
2. Application based cookie - Cookie name will be specified by the App, Based on duration
***************************************************
Demo 4 – Network Load Balancer
***************************************************
Tasks:
---------------
1. Launch 2 Instances - Keep different data in each instance
2. Create NLB, TG
NLB 1.1: Welcome to CIVIL Edu
NLB 1.2: Batch 9 of AWS and DevOps Training
NLB Name: 04AprilB9-NLB
TG Name: 04AprilB9-TG-NLB
==============================================
Connecting to EC2 Instance using Sessions Manager
==============================================
Assume that you have an EC2 instance which is created in the Private Subnet and you need to connect to the instance without using SSH (MobaXTerm). How to do that?
We will AWS Sessions Manager
If you want to work with the AWS Sessions Manager we have to create IAM Role for the EC2 instance and attach "AWSSSMManagedInstanceCore" Policy.
Advantages:
1. No ports are needed to be allowed in SG
2. You can run the instances in private subnets
2. No need of SSH keys (.pem)
Tasks:
--------------
1. Launch Instance
2. Create IAM Role
3. Connect with Sessions Manger
------------------------------------------------
User data for Launch Template
------------------------------------------------
#!/bin/bash
yum update -y
yum install -y httpd
systemctl start httpd
systemctl enable httpd
usermod -a -G apache ec2-user
chown -R ec2-user:apache /var/www
chmod 2775 /var/www
echo "Hi Kastro from $(hostname)" > /var/www/html/index.html
----------------------------------------------------------
Commands to increase load on Instance:
----------------------------------------------------------
sudo amazon-linux-extras install epel -y
sudo yum install stress -y
stress --cpu 8