Skip to content

Commit 03a92d5

Browse files
author
abregman
committed
Add different solutions to AWS exercises
Not only console solutions, but also Terraform and Pulumi. In addition, this change fixes issues #279 and #280
1 parent 591ef74 commit 03a92d5

File tree

17 files changed

+210
-46
lines changed

17 files changed

+210
-46
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
:information_source:  This repo contains questions and exercises on various technical topics, sometimes related to DevOps and SRE
44

5-
:bar_chart:  There are currently **2393** exercises and questions
5+
:bar_chart:  There are currently **2402** exercises and questions
66

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

topics/aws/README.md

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# AWS
22

33
**Note**: Provided solutions are using the AWS console. It's recommended you'll use IaC technologies to solve the exercises (e.g. Terraform, Pulumi).<br>
4-
**2nd Note**: Some of the exercises cost money and can't be performed using the free tier/resources
4+
**2nd Note**: Some of the exercises cost $$$ and can't be performed using the free tier/resources
55

66
- [AWS](#aws)
77
- [Exercises](#exercises)
@@ -15,6 +15,7 @@
1515
- [Containers](#containers)
1616
- [Lambda](#lambda)
1717
- [Elastic Beanstalk](#elastic-beanstalk)
18+
- [CodePipeline](#codepipeline)
1819
- [Misc](#misc)
1920
- [Questions](#questions)
2021
- [Global Infrastructure](#global-infrastructure)
@@ -39,6 +40,7 @@
3940
- [Disaster Recovery](#disaster-recovery)
4041
- [CloudFront](#cloudfront)
4142
- [ELB](#elb-1)
43+
- [ALB](#alb)
4244
- [Auto Scaling Group](#auto-scaling-group)
4345
- [Security](#security-1)
4446
- [Databases](#databases-1)
@@ -58,6 +60,7 @@
5860
- [Production Operations and Migrations](#production-operations-and-migrations)
5961
- [Scenarios](#scenarios)
6062
- [Architecture Design](#architecture-design)
63+
- [Misc](#misc-2)
6164

6265
## Exercises
6366

@@ -1395,15 +1398,17 @@ True. AWS responsible for making sure ELB is operational and takes care of lifec
13951398
</b></details>
13961399

13971400
<details>
1398-
<summary>Which load balancer would you use for services which use HTTP or HTTPS traffic?</summary><br><b>
1401+
<summary>What's a "listener" in regards to ELB?</summary><br><b>
1402+
</b></details>
13991403

1400-
Application Load Balancer (ALB).
1404+
<details>
1405+
<summary>What's a "target group" in regards to ELB?</summary><br><b>
14011406
</b></details>
14021407

14031408
<details>
1404-
<summary>True or False? With ALB (Application Load Balancer) it's possible to do routing based on query string and/or headers</summary><br><b>
1409+
<summary>Which load balancer would you use for services which use HTTP or HTTPS traffic?</summary><br><b>
14051410

1406-
True.
1411+
Application Load Balancer (ALB).
14071412
</b></details>
14081413

14091414
<details>
@@ -1440,7 +1445,7 @@ For example, port `2017` and endpoint `/health`.
14401445

14411446
<details>
14421447
<summary>Which type of AWS load balancer is used in the following drawing?<br>
1443-
<img src="images/aws/identify_load_balancer.png" width="300px;" height="400px;"/>
1448+
<img src="../../images/aws/identify_load_balancer.png"/>
14441449
</summary><br><b>
14451450

14461451
Application Load Balancer (routing based on different endpoints + HTTP is used).
@@ -1525,12 +1530,6 @@ False. This is only supported in Classic Load Balancer and Application Load Bala
15251530
With cross zone load balancing, traffic distributed evenly across all (registered) instances in all the availability zones.
15261531
</b></details>
15271532

1528-
<details>
1529-
<summary>True or False? For application load balancer, cross zone load balancing is always on and can't be disabled</summary><br><b>
1530-
1531-
True
1532-
</b></details>
1533-
15341533
<details>
15351534
<summary>True or False? For network load balancer, cross zone load balancing is always on and can't be disabled </summary><br><b>
15361535

@@ -1540,7 +1539,7 @@ False. It's disabled by default
15401539
<details>
15411540
<summary>True or False? In regards to cross zone load balancing, AWS charges you for inter AZ data in network load balancer but no in application load balancer</summary><br><b>
15421541

1543-
False. It charges fir inter AZ data in network load balancer, but not in application load balancer
1542+
False. It charges for inter AZ data in network load balancer, but not in application load balancer
15441543
</b></details>
15451544

15461545
<details>
@@ -1555,6 +1554,20 @@ True
15551554
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.
15561555
</b></details>
15571556

1557+
#### ALB
1558+
1559+
<details>
1560+
<summary>True or False? With ALB (Application Load Balancer) it's possible to do routing based on query string and/or headers</summary><br><b>
1561+
1562+
True.
1563+
</b></details>
1564+
1565+
<details>
1566+
<summary>True or False? For application load balancer, cross zone load balancing is always on and can't be disabled</summary><br><b>
1567+
1568+
True
1569+
</b></details>
1570+
15581571
### Auto Scaling Group
15591572

15601573
<details>
@@ -3157,3 +3170,12 @@ Network Load Balancer
31573170

31583171
You can use an ElastiCache cluster or RDS Read Replicas.
31593172
</b></details>
3173+
3174+
### Misc
3175+
3176+
<details>
3177+
<summary>What's an ARN?</summary><br><b>
3178+
3179+
ARN (Amazon Resources Names) used for uniquely identifying different AWS resources.
3180+
It is used when you would like to identify resource uniqely across all AWS infra.
3181+
</b></details>
Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
## AWS VPC - My First VPC
1+
# My First VPC
22

3-
### Objectives
3+
## Objectives
44

55
1. Create a new VPC
6-
1. It should have a CIDR that supports using at least 60,000 hosts
6+
1. It should have a CIDR that supports using at least 60,000 hosts
7+
2. It should be named "exercise-vpc"
8+
9+
## Solution
10+
11+
Click [here](solution.md) to view the solution

topics/aws/exercises/new_vpc/main.tf

Whitespace-only changes.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import pulumi
2+
import pulumi_awsx as awsx
3+
4+
vpc = awsx.ec2.Vpc("exercise-vpc", cidr_block="10.0.0.0/16")
5+
6+
pulumi.export("vpc_id", vpc.vpc_id)
7+
pulumi.export("publicSubnetIds", vpc.public_subnet_ids)
8+
pulumi.export("privateSubnetIds", vpc.private_subnet_ids)
9+
10+
# Run 'pulumi up' to create it
Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,30 @@
1-
## AWS VPC - My First VPC
1+
# My First VPC
22

3-
### Objectives
3+
## Objectives
44

55
1. Create a new VPC
6-
1. It should have a CIDR that supports using at least 60,000 hosts
6+
1. It should have a CIDR that supports using at least 60,000 hosts
7+
2. It should be named "exercise-vpc"
78

8-
### Solution
9+
## Solution
910

10-
#### Console
11+
### Console
1112

1213
1. Under "Virtual Private Cloud" click on "Your VPCs"
1314
2. Click on "Create VPC"
14-
3. Insert a name (e.g. someVPC)
15+
3. Insert a name - "exercise-vpc"
1516
4. Insert IPv4 CIDR block: 10.0.0.0/16
1617
5. Keep "Tenancy" at Default
1718
6. Click on "Create VPC"
19+
20+
### Terraform
21+
22+
Click [here](terraform/main.tf) to view the solution
23+
24+
### Pulumi - Python
25+
26+
Click [here](pulumi/__main__.py) to view the solution
27+
28+
### Verify Solution
29+
30+
To verify you've create the VPC, you can run: `aws ec2 describe-vpcs -filters Name=tag:Name,Values=exercise-vpc`
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
resource "aws_vpc" "exercise-vpc" {
2+
cidr_block = "10.0.0.0/16"
3+
4+
tags = {
5+
Name = "exercise-vpc"
6+
}
7+
}
8+
9+
output "vpc-id" {
10+
value = aws_vpc.exercise-vpc.id
11+
}

topics/aws/exercises/subnets/exercise.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
### Requirements
44

5-
Single newly created VPC
5+
1. Single newly created VPC
6+
2. Region with more than two availability zones
67

78
### Objectives
89

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import pulumi
2+
import pulumi_aws as aws
3+
4+
availableZones = pulumi_aws.get_availability_zones(state="available")
5+
6+
aws.ec2.Subnet("NewSubnet1",
7+
vpc_id=aws_vpc["main"]["id"],
8+
cidr_block="10.0.0.0/24",
9+
availability_zone=availableZones.names[0],
10+
tags={"Name": "NewSubnet1"}
11+
)
12+
13+
aws.ec2.Subnet("NewSubnet2",
14+
vpc_id=aws_vpc["main"]["id"],
15+
cidr_block="10.0.1.0/24",
16+
availability_zone=availableZones.names[1]
17+
tags={"Name": "NewSubnet2"}
18+
)
19+
20+
aws.ec2.Subnet("NewSubnet3",
21+
vpc_id=aws_vpc["main"]["id"],
22+
cidr_block="10.0.2.0/24",
23+
availability_zone=availableZones.names[2]
24+
tags={"Name": "NewSubnet3"}
25+
)
26+
27+
# Run "pulumi up"
Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
1-
## AWS VPC - Subnets
1+
# AWS VPC - Subnets
22

3-
### Requirements
3+
## Requirements
44

5-
Single newly created VPC
5+
1. Single newly created VPC
6+
2. Region with more than two availability zones
67

7-
### Objectives
8+
## Objectives
89

910
1. Create a subnet in your newly created VPC
10-
1. CIDR: 10.0.0.0/24
11-
2. Name: NewSubnet1
11+
1. CIDR: 10.0.0.0/24
12+
1. Name: NewSubnet1
1213
2. Create additional subnet
13-
1. CIDR: 10.0.1.0/24
14-
2. Name: NewSubnet2
15-
3. Different AZ compared to previous subnet
14+
1. CIDR: 10.0.1.0/24
15+
2. Name: NewSubnet2
16+
3. Different AZ compared to previous subnet
1617
3. Create additional subnet
17-
1. CIDR: 10.0.2.0/24
18-
2. Name: NewSubnet3
19-
3. Different AZ compared to previous subnets
18+
4. CIDR: 10.0.2.0/24
19+
5. Name: NewSubnet3
20+
6. Different AZ compared to previous subnets
2021

21-
### Solution
22+
## Solution
2223

23-
#### Console
24+
### Console
2425

2526
1. Click on "Subnets" under "Virtual Private Cloud"
2627
2. Make sure you filter by your newly created VPC (to not see the subnets in all other VPCs). You can do this in the left side menu
@@ -37,3 +38,11 @@ Single newly created VPC
3738
13. Set the subnet name to "NewSubnet3"
3839
14. Choose a different AZ
3940
15. Set CIDR to 10.0.2.0/24
41+
42+
### Terraform
43+
44+
Click [here](terraform/main.tf) to view the solution
45+
46+
### Pulumi - Python
47+
48+
Click [here](pulumi/__main__.py) to view the solution

0 commit comments

Comments
 (0)