Skip to content

Commit f7edd72

Browse files
author
abregman
committed
Add a couple of AWS exercises
Questions as well :)
1 parent 8b0360e commit f7edd72

8 files changed

+249
-8
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<p align="center"><img src="images/devops_exercises.png"/></p>
22

3-
:information_source: &nbsp;This repo contains questions and exercises on various technical topics, sometimes related to DevOps and SRE :)
3+
:information_source: &nbsp;This repo contains questions and exercises on various technical topics, sometimes related to DevOps and SRE
44

5-
:bar_chart: &nbsp;There are currently **1999** questions
5+
:bar_chart: &nbsp;There are currently **1999** exercises and questions
66

77
:books: &nbsp;To learn more about DevOps and SRE, check the resources in [devops-resources](https://github.com/bregman-arie/devops-resources) repository
88

99
:warning: &nbsp;You can use these for preparing for an interview but most of the questions and exercises don't represent an actual interview. Please read [FAQ page](faq.md) for more details
1010

11-
:busts_in_silhouette: &nbsp;[Join](https://www.facebook.com/groups/538897960007080) our [DevOps community](https://www.facebook.com/groups/538897960007080) where we have discussions and share resources on DevOps
11+
:busts_in_silhouette: &nbsp;Join our [DevOps community](https://www.facebook.com/groups/538897960007080) where we have discussions and share resources on DevOps
1212

1313
:pencil: &nbsp;You can add more questions and exercises by submitting pull requests :) Read about contribution guidelines [here](CONTRIBUTING.md)
1414

exercises/aws/README.md

+144-5
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@
1818
|--------|--------|------|----|----|
1919
| Launch EC2 web instance | EC2 | [Exercise](launch_ec2_web_instance.md) | [Solution](solutions/launch_ec2_web_instance.md) | Easy |
2020
| Security Groups | EC2 | [Exercise](security_groups.md) | [Solution](solutions/security_groups.md) | Easy |
21-
| IAM Roles | EC2 + IAM | [Exercise](ec2_iam_roles.md) | [Solution](solutions/ec2_iam_roles.md) | Easy |
21+
| IAM Roles | EC2, IAM | [Exercise](ec2_iam_roles.md) | [Solution](solutions/ec2_iam_roles.md) | Easy |
2222
| Spot Instances | EC2 | [Exercise](create_spot_instances.md) | [Solution](solutions/create_spot_instances.md) | Easy |
23-
23+
| Elastic IP | EC2, Networking | [Exercise](elastic_ip.md) | [Solution](solutions/elastic_ip.md) | Easy |
24+
| Placement Groups Creation | EC2, Placement Groups | [Exercise](placement_groups.md) | [Solution](solutions/placement_groups.md) | Easy |
25+
| Elastic Network Interfaces | EC2, ENI | [Exercise](elastic_network_interfaces.md) | [Solution](solutions/elastic_network_interfaces.md) | Easy |
2426

2527
#### AWS - Lambda
2628

@@ -303,13 +305,33 @@ Storage Optimized:
303305
* Use cases: databases, OLTP system, distributing file systems
304306
</b></details>
305307

308+
<details>
309+
<summary>What can you attach to an EC2 instance in order to store data?</summary><br><b>
310+
311+
EBS
312+
</b></details>
313+
314+
##### AWS EC2 - EBS
315+
306316
<details>
307317
<summary>What is EBS?</summary><br><b>
308318

309319
"provides block level storage volumes for use with EC2 instances. EBS volumes behave like raw, unformatted block devices."
310320
More on EBS [here](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AmazonEBS.html)
311321
</b></details>
312322

323+
<details>
324+
<summary>What happens to EC2 disk (EBS) when the instance is terminated?</summary><br><b>
325+
326+
All the related EBS volumes are removed and data is lost.
327+
</b></details>
328+
329+
<details>
330+
<summary>What happens to the EC2 disk (EBS) when the instance is stopped?</summary><br><b>
331+
332+
Disk is intact and can be used when the instance starts.
333+
</b></details>
334+
313335
<details>
314336
<summary>What EC2 pricing models are there?</summary><br><b>
315337

@@ -509,6 +531,24 @@ Set of Spot instance and if you want, also on-demand instances.
509531
* capacityOptimized: optimized based on the number of instances
510532
</b></details>
511533

534+
<details>
535+
<summary>From networking perspective, what do you get by default when running an EC2 instance?</summary><br><b>
536+
537+
A private IP and a public IP.
538+
</b></details>
539+
540+
<details>
541+
<summary>What happens when you hibernate an EC2 instance?</summary><br><b>
542+
543+
[AWS Docs](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html: "Hibernation saves the contents from the instance memory (RAM) to your Amazon Elastic Block Store (Amazon EBS) root volume."
544+
</b></details>
545+
546+
<details>
547+
<summary>True or False? Using EC2 hibernate option results in having faster instance boot</summary><br><b>
548+
549+
True. This is because the operating system isn't restarted or stopped.
550+
</b></details>
551+
512552
#### AWS - Lambda
513553

514554
<details>
@@ -1100,8 +1140,26 @@ False. Only one internet gateway can be attached to a single VPC.
11001140

11011141
<details>
11021142
<summary>What is an Elastic IP address?</summary><br><b>
1103-
An Elastic IP address is a reserved public IP address that you can assign to any EC2 instance in a particular region, until you choose to release it.
1104-
When you associate an Elastic IP address with an EC2 instance, it replaces the default public IP address. If an external hostname was allocated to the instance from your launch settings, it will also replace this hostname; otherwise, it will create one for the instance. The Elastic IP address remains in place through events that normally cause the address to change, such as stopping or restarting the instance.
1143+
1144+
[AWS Docs](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses-eip.html): "An Elastic IP address is a static IPv4 address designed for dynamic cloud computing. An Elastic IP address is allocated to your AWS account, and is yours until you release it. By using an Elastic IP address, you can mask the failure of an instance or software by rapidly remapping the address to another instance in your account."
1145+
</b></details>
1146+
1147+
<details>
1148+
<summary>True or False? When stopping and starting an EC2 instance, its public IP changes</summary><br><b>
1149+
1150+
True
1151+
</b></details>
1152+
1153+
<details>
1154+
<summary>What are the best practices around Elastic IP?</summary><br><b>
1155+
1156+
The best practice is actually not using them in the first place. It's more common to use a load balancer without a public IP or use a random public IP and register a DNS record to it
1157+
</b></details>
1158+
1159+
<details>
1160+
<summary>True or False? An Elastic IP is free, as long it's not associated with an EC2 instance</summary><br><b>
1161+
1162+
False. An Elastic IP is free of charge as long as **it is ** associated with an EC2 instance. This instance should be running and should have only one Elastic IP.
11051163
</b></details>
11061164

11071165
<details>
@@ -1125,6 +1183,88 @@ Read more about it [here](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec
11251183
Allows you to connect your corporate network to AWS network.
11261184
</b></details>
11271185

1186+
<details>
1187+
<summary>True or False? When you need a fixed public IP for your instance, you should use an Elastic IP</summary><br><b>
1188+
1189+
True
1190+
</b></details>
1191+
1192+
##### AWS EC2 - ENI
1193+
1194+
<details>
1195+
<summary>Explain Elastic Network Interfaces (ENI)</summary><br><b>
1196+
1197+
[AWS Docs](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html): "An elastic network interface is a logical networking component in a VPC that represents a virtual network card."
1198+
</b></details>
1199+
1200+
<details>
1201+
<summary>Name at least three attributes the Elastic Network Interfaces (ENI) can include</summary><br><b>
1202+
1203+
1. One public IPv4 address
1204+
2. Mac Address
1205+
3. A primary private IPv4 address (from the address range of your VPC)
1206+
</b></details>
1207+
1208+
<details>
1209+
<summary>True or False? ENI are not bound to a specific availability zone</summary><br><b>
1210+
1211+
False. ENI are bound to specific availability zone.
1212+
</b></details>
1213+
1214+
<details>
1215+
<summary>True or False? ENI can be created independently of EC2 instances</summary><br><b>
1216+
1217+
True. They can be attached later on and on the fly (for failover purposes).
1218+
</b></details>
1219+
1220+
##### AWS EC2 - Placement Groups
1221+
1222+
<details>
1223+
<summary>What are "Placement Groups"?</summary><br><b>
1224+
1225+
[AWS Docs](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/placement-groups.html): "When you launch a new EC2 instance, the EC2 service attempts to place the instance in such a way that all of your instances are spread out across underlying hardware to minimize correlated failures. You can use placement groups to influence the placement of a group of interdependent instances to meet the needs of your workload."
1226+
</b></details>
1227+
1228+
<details>
1229+
<summary>What Placement Groups strategies are there?</summary><br><b>
1230+
1231+
* Cluster: places instance close together in an AZ.
1232+
* Spread: spreads the instance across the hardware
1233+
* Partition: spreads the instances across different partitions (= different sets of hardware/racks) within an AZ
1234+
</b></details>
1235+
1236+
<details>
1237+
<summary>For each of the following scenarios choose a placement group strategy:
1238+
1239+
* High availability is top priority
1240+
* Low latency between instances
1241+
* Instances must be isolated from each other
1242+
* Big Data applications that are partition aware
1243+
* Big Data process that needs to end quickly</summary><br><b>
1244+
1245+
* High availability is top priority - Spread
1246+
* Low latency between instances - Cluster
1247+
* Instances must be isolated from each other - Spread
1248+
* Big Data applications that are partition aware - Partition
1249+
* Big Data process that needs to end quickly - Cluster
1250+
</b></details>
1251+
1252+
<details>
1253+
<summary>What are the cons and pros of the "Cluster" placement group strategy?</summary><br><b>
1254+
1255+
Cons: if the hardware fails, all instances fail
1256+
Pros: Low latency & high throughput network
1257+
</b></details>
1258+
1259+
<details>
1260+
<summary>What are the cons and pros of the "Spread" placement group strategy?</summary><br><b>
1261+
1262+
Cons:
1263+
* Current limitation is 7 instances per AZ (per replacement group)
1264+
Pros:
1265+
* Maximized high availability (instances on different hardware, span across AZs)
1266+
</b></details>
1267+
11281268
#### AWS - Identify the service or tool
11291269

11301270
<details>
@@ -1668,4 +1808,3 @@ AWS definition: "Amazon Simple Queue Service (SQS) is a fully managed message qu
16681808

16691809
Learn more about it [here](https://aws.amazon.com/sqs)
16701810
</b></details>
1671-

exercises/aws/elastic_ip.md

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
## AWS EC2 - Elastic IP
2+
3+
### Requirements
4+
5+
* An EC2 instance with public IP (not elastic IP)
6+
7+
### Objectives
8+
9+
1. Write down the public IP of your EC2 instance somewhere and stop & start the instance. Does the public IP address is the same? why?
10+
2. Handle this situation so you have the same public IP even after stopping and starting the instance
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
## AWS EC2 - Elastic Network Interfaces
2+
3+
### Requirements
4+
5+
* An EC2 instance with network interface
6+
7+
### Objectives
8+
9+
A. Create a network interface and attach it to the EC2 instance that already has one network interface
10+
B. Explain why would anyone use two network interfaces

exercises/aws/placement_groups.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## AWS EC2 - Placement Groups
2+
3+
### Objectives
4+
5+
A. Create a placement group. It should be one with a low latency network. Make sure to launch an instance as part of this placement group.
6+
B. Create another placement group. This time high availability is a priority

exercises/aws/solutions/elastic_ip.md

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
## AWS EC2 - Elastic IP
2+
3+
### Requirements
4+
5+
* An EC2 instance with public IP (not elastic IP)
6+
7+
### Objectives
8+
9+
1. Write down the public IP of your EC2 instance somewhere and stop & start the instance. Does the public IP address is the same? why?
10+
2. Handle this situation so you have the same public IP even after stopping and starting the instance
11+
12+
### Solution
13+
14+
1. Go to EC2 service -> Instances
15+
1. Write down current public IP address
16+
2. Click on "Instance state" -> Stop instance -> Stop
17+
3. Click on "Instance state" -> Start Instance
18+
4. Yes, the public IP address has changed
19+
2. Let's use an Elastic IP address
20+
1. In EC2 service, under "Network & Security" click on "Elastic IP"
21+
2. Click on the "Allocate elastic IP address" button
22+
3. Make sure you select "Amazon's pool of IPv4 addresses" and click on "Allocate"
23+
4. Click on "Actions" and then "Associate Elastic IP address"
24+
1. Select "instance", choose your instance and provide its private IP address
25+
2. Click on "Associate"
26+
5. Now, if we go back to the instance page, we can see it is using the Elastic IP address as its public IP
27+
28+
Note: to remove it, use "disassociate" option and don't forget to also release it so you won't be billed.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
## AWS EC2 - Elastic Network Interfaces
2+
3+
### Requirements
4+
5+
* An EC2 instance with network interface
6+
7+
### Objectives
8+
9+
A. Create a network interface and attach it to the EC2 instance that already has one network interface
10+
B. Explain why would anyone use two network interfaces
11+
12+
### Solution
13+
14+
A.
15+
1. Go to EC2 service
16+
2. Click on "Network Interfaces" under "Network & Security"
17+
3. Click on "Create network interface"
18+
4. Provide a description
19+
5. Choose a subnet (one that is in the AZ as the instance)
20+
6. Optionally attach a security group and click on "Create network interface"
21+
7. Click on "Actions" -> "Attach" and choose the instance to attach it to
22+
8. If you go now to "Instances" page you'll see your instance has two network interfaces
23+
24+
B.
25+
1. You can move the second network interface between instances. This allows us to create kind of a failover mechanism between the instances.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
## AWS EC2 - Placement Groups
2+
3+
### Objectives
4+
5+
A. Create a placement group. It should be one with a low latency network. Make sure to launch an instance as part of this placement group.
6+
B. Create another placement group. This time high availability is a priority
7+
8+
### Solution
9+
10+
A.
11+
1. Go to EC2 service
12+
2. Click on "Placement Groups" under "Network & Security"
13+
3. Click on "Create placement group"
14+
4. Give it a name and choose the "Cluster" placement strategy because the requirement is low latency network
15+
5. Click on "Create group"
16+
6. Go to "Instances" and click on "Launch an instance". Choose any properties you would like, just make sure to check "Add instance to placement group" and choose the placement group you've created
17+
18+
B.
19+
1. Go to EC2 service
20+
2. Click on "Placement Groups" under "Network & Security"
21+
3. Click on "Create placement group"
22+
4. Give it a name and choose the "Spread" placement strategy because the requirement is high availability as top priority
23+
5. Click on "Create group"

0 commit comments

Comments
 (0)