Add AWS exercises and questions
This commit is contained in:
@ -44,6 +44,7 @@ Note: Provided solutions are using the AWS console. It's recommended you'll use
|
||||
|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 |
|
||||
| Dynamic Scaling Policy | ASG, Policies | [Exercise](asg_dynamic_scaling_policy.md) | [Solution](solutions/asg_dynamic_scaling_policy.md) | Easy |
|
||||
|
||||
#### AWS - Lambda
|
||||
|
||||
@ -1287,13 +1288,54 @@ One way is to use CloudWatch alarms where an alarm will monitor a metric and bas
|
||||
</b></details>
|
||||
|
||||
<details>
|
||||
<summary>Provide examples to metrics/rules used for auto scaling</summary><br><b>
|
||||
<summary>What are some 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>
|
||||
|
||||
<details>
|
||||
<summary>What is dynamic Scaling policy in regards to Auto Scaling Groups?</summary><br><b>
|
||||
|
||||
A policy in which scaling will occur automatically based on different metrics.
|
||||
|
||||
There are 3 types:
|
||||
|
||||
1. Target Tracking Scaling: scale when the baseline changes (e.g. CPU is over 60%)
|
||||
2. Step Scaling: more granular scaling where you can choose different actions for different metrics values (e.g. when CPU less than 20%, remove one instance. When CPU is over 40%, add 3 instances)
|
||||
3. Scheduled Actions: set in advance scaling for specific period of time (e.g. add instances on Monday between 10:00 am to 11:00 am)
|
||||
</b></details>
|
||||
|
||||
<details>
|
||||
<summary>What is a predictive scaling policy in regards to Auto Scaling Groups?</summary><br><b>
|
||||
|
||||
Scale by analyzing historical load and schedule scaling based on forecast load.
|
||||
</b></details>
|
||||
|
||||
<details>
|
||||
<summary>Explain scaling cooldowns in regards to Auto Scaling Groups</summary><br><b>
|
||||
|
||||
During a scaling cooldown, ASG will not terminate or launch additional instances. The cooldown happens after scaling activity and the reason for this behaviour is that some metrics have to be collected and stabilize before another scaling operating can take place.
|
||||
</b></details>
|
||||
|
||||
<details>
|
||||
<summary>Explain the default ASG termination policy</summary><br><b>
|
||||
|
||||
1. It finds the AZ which the most number of EC2 instnaces
|
||||
2. If number of instances > 1, choose the with oldest launch configuration, template and terminate it
|
||||
</b></details>
|
||||
|
||||
<details>
|
||||
<summary>True or False? by deafult, ASG tries to balance the number of instances across AZ</summary><br><b>
|
||||
|
||||
True, this is why when it terminates instances, it chooses the AZ with the most instances.
|
||||
</b></details>
|
||||
|
||||
<details>
|
||||
<summary>Explain Lifecycle Hooks in regards to Auto Scaling Groups</summary><br><b>
|
||||
</b></details>
|
||||
|
||||
#### AWS - Security
|
||||
|
||||
<details>
|
||||
|
16
exercises/aws/asg_dynamic_scaling_policy.md
Normal file
16
exercises/aws/asg_dynamic_scaling_policy.md
Normal file
@ -0,0 +1,16 @@
|
||||
## AWS Auto Scaling Groups - Dynamic Scaling Policy
|
||||
|
||||
### Requirements
|
||||
|
||||
1. Existing Auto Scaling Group with maximum capacity set to at least 3
|
||||
2. One running EC2 instance with max of 4 CPUs
|
||||
|
||||
### Objectives
|
||||
|
||||
1. Create a dynamic scaling policy with the following properties
|
||||
1. Track average CPU utilization
|
||||
2. Target value should be 70%
|
||||
2. Increase the CPU utilization to at least 70%
|
||||
1. Do you see change in number of instances?
|
||||
1. Decrease CPU utilization to less than 70%
|
||||
1. Do you see change in number of instances?
|
37
exercises/aws/solutions/asg_dynamic_scaling_policy.md
Normal file
37
exercises/aws/solutions/asg_dynamic_scaling_policy.md
Normal file
@ -0,0 +1,37 @@
|
||||
## AWS Auto Scaling Groups - Dynamic Scaling Policy
|
||||
|
||||
### Requirements
|
||||
|
||||
1. Existing Auto Scaling Group with maximum capacity set to at least 3
|
||||
2. One running EC2 instance with max of 4 CPUs
|
||||
|
||||
### Objectives
|
||||
|
||||
1. Create a dynamic scaling policy with the following properties
|
||||
1. Track average CPU utilization
|
||||
2. Target value should be 70%
|
||||
2. Increase the CPU utilization to at least 70%
|
||||
1. Do you see change in number of instances?
|
||||
1. Decrease CPU utilization to less than 70%
|
||||
1. Do you see change in number of instances?
|
||||
|
||||
### Solution
|
||||
|
||||
#### Console
|
||||
|
||||
1. Go to EC2 service -> Auto Scaling Groups and click on the tab "Automating scaling"
|
||||
2. Choose "Target tracking scaling" under "Policy Type"
|
||||
3. Set metric type to Average CPU utilization
|
||||
4. Set target value to 70% and click on "Create"
|
||||
|
||||
1. If you are using Amazon Linux 2, you can stress the instance with the following:
|
||||
|
||||
```
|
||||
sudo amazon-linux-extras install epel -y
|
||||
sudo yum install stress -y
|
||||
stress -c 4 # assuming you have 4 CPUs
|
||||
```
|
||||
2. Yes, additional EC2 instance was added
|
||||
|
||||
1. Simply stop the stress command
|
||||
2. Yes, one of the EC2 instances was terminated
|
Reference in New Issue
Block a user