Add AWS exercise and questions

Mostly on Auto Scaling Groups.
This commit is contained in:
abregman 2021-11-23 16:15:54 +02:00
parent 6aa674a1c1
commit 195174a5b9
5 changed files with 120 additions and 3 deletions

View File

@ -2,7 +2,7 @@
:information_source:  This repo contains questions and exercises on various technical topics, sometimes related to DevOps and SRE
:bar_chart:  There are currently **2112** exercises and questions
:bar_chart:  There are currently **2138** exercises and questions
:books:  To learn more about DevOps and SRE, check the resources in [devops-resources](https://github.com/bregman-arie/devops-resources) repository
@ -1884,9 +1884,11 @@ Using the `last` command.
#### Linux Hardware
<details>
<summary>Where can you find information on the processor?</summary><br><b>
<summary>Where can you find information on the processor (like number of CPUs)?</summary><br><b>
/proc/cpuinfo
You can also use `nproc` for number of processors
</b></details>
<details>

View File

@ -39,6 +39,12 @@ Note: Provided solutions are using the AWS console. It's recommended you'll use
| Multiple Target Groups | ELB, ALB | [Exercise](alb_multiple_target_groups.md) | [Solution](solutions/alb_multiple_target_groups.md) | Easy |
| Network Load Balancer | ELB, NLB | [Exercise](network_load_balancer.md) | [Solution](solutions/network_load_balancer.md) | Easy |
#### AWS - Auto Scaling Groups
|Name|Topic|Objective & Instructions|Solution|Comments|
|--------|--------|------|----|----|
| Auto Scaling Groups Basics | ASG | [Exercise](auto_scaling_groups_basics.md) | [Solution](solutions/auto_scaling_groups_basics.md) | Easy |
#### AWS - Lambda
|Name|Topic|Objective & Instructions|Solution|Comments|
@ -1254,7 +1260,41 @@ False. It charges fir inter AZ data in network load balancer, but not in applica
True
</b></details>
#### AWS Security
<details>
<summary>Explain Deregistration Delay (or Connection Draining) in regards to ELB</summary><br><b>
The period of time or process of "draining" instances from requests/traffic (basically let it complete all active connections but don't start new ones) so it can be de-registered eventually and ELB won't send requests/traffic to it anymore.
</b></details>
#### AWS - Auto Scaling Group
<details>
<summary>Explain Auto Scaling Group</summary><br><b>
[Amazon Docs](https://docs.aws.amazon.com/autoscaling/ec2/userguide/AutoScalingGroup.html): "An Auto Scaling group contains a collection of Amazon EC2 instances that are treated as a logical grouping for the purposes of automatic scaling and management. An Auto Scaling group also enables you to use Amazon EC2 Auto Scaling features such as health check replacements and scaling policies"
</b></details>
<details>
<summary>You have two instance running as part of ASG. You change the desired capacity to 1. What will be the outcome of this change?</summary><br><b>
One of the instances will be terminated.
</b></details>
<details>
<summary>How can you customize the trigger for the scaling in/out of an auto scaling group?</summary><br><b>
One way is to use CloudWatch alarms where an alarm will monitor a metric and based on a certain value (or range) you can choose to scale-in or scale-out the ASG.
</b></details>
<details>
<summary>Provide examples to metrics/rules used for auto scaling</summary><br><b>
* Network In/Out
* Number of requests on ELB per instance
* Average CPU, RAM usage
</b></details>
#### AWS - Security
<details>
<summary>What is the shared responsibility model? What AWS is responsible for and what the user is responsible for based on the shared responsibility model?</summary><br><b>

View File

@ -0,0 +1,21 @@
## AWS Auto Scaling Groups - Basics
### Requirements
Zero EC2 instances running
### Objectives
A. Create a scaling group for web servers with the following properties:
* Amazon Linux 2 AMI
* t2.micro as the instance type
* user data:
```
yum install -y httpd
systemctl start httpd
systemctl enable httpd
```
B. Were new instances created since you created the auto scaling group? How many? Why?
C. Change desired capacity to 2. Did it launch more instances?
D. Change back the desired capacity to 1. What is the result of this action?

View File

@ -0,0 +1,48 @@
## AWS Auto Scaling Groups - Basics
### Requirements
Zero EC2 instances running
### Objectives
A. Create a scaling group for web servers with the following properties:
* Amazon Linux 2 AMI
* t2.micro as the instance type
* user data:
```
yum install -y httpd
systemctl start httpd
systemctl enable httpd
```
B. Were new instances created since you created the auto scaling group? How many? Why?
C. Change desired capacity to 2. Did it launch more instances?
D. Change back the desired capacity to 1. What is the result of this action?
### Solution
#### Console
A.
1. Go to EC2 service
2. Click on "Auto Scaling Groups" under "Auto Scaling"
3. Click on "Create Auto Scaling Group"
4. Insert a name
5. Click on "Create a launch template"
1. Insert a name and a version for the template
2. Select an AMI to use (Amazon Linux 2)
3. Select t2.micro instance type
4. Select a key pair
5. Attach a security group
6. Under "Advanced" insert the user data
7. Click on "Create"
6. Choose the launch template you've just created and click on "Next"
7. Choose "Adhere to launch template"
8. Choose in which AZs to launch and click on "Next"
9. Link it to ALB (if you don't have one, create it)
10. Mark ELB health check in addition to EC2. Click on "Next" until you reach the review page and click on "Create auto scaling group"
B. One instance was launched to met the criteria of the auto scaling group we've created. The reason it launched only one is due to "Desired capacity" set to 1.
C. Change it by going to your auto scaling group -> Details -> Edit -> "2 desired capacity". This should create another instance if only one is running
D. Reducing desired capacity back to 1 will terminate one of the instances (assuming 2 are running).

View File

@ -408,6 +408,12 @@ SNI allows a single server to serve multiple certificates using the same IP and
Practically this means that a single IP can server multiple web services/pages, each using a different certificate.
</b></details>
<details>
<summary>Explain "Web Cache Deception Attach"</summary><br><b>
[This blog post](https://omergil.blogspot.com/2017/02/web-cache-deception-attack.html) explains it in detail.
</b></details>
#### Security - Threats
<details>