Skip to content

Commit e00fd92

Browse files
authored
Terraform AWS VPC Tutorial - Public, Private, and Isolated Subnets (#468)
1 parent b7f2da3 commit e00fd92

31 files changed

+1768
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# New Video - [YouTube](https://youtu.be/9hDvWVJtljE)
1+
# New Video - https://youtu.be/TQ_V9TYoRvw
22

3-
[<img src="assets/258.png?raw=true">](https://youtu.be/9hDvWVJtljE)
3+
[<img src="assets/256.png?raw=true">](https://youtu.be/TQ_V9TYoRvw)
44

55
# Consulting
66

assets/256.png

226 KB
Loading

assets/258.png

-407 KB
Binary file not shown.

docs/contents.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,4 +182,5 @@
182182
- [253 - Redis Streams vs Pub/Sub: Performance](../lessons/253)
183183
- [254 - Intel vs AMD vs Graviton: Performance & Price](../lessons/254)
184184
- [255 - Terraform Tutorial on AWS](../lessons/255)
185+
- [256 - Terraform AWS VPC Tutorial - Public, Private, and Isolated Subnets](../lessons/256)
185186
- [258 - Redis vs Valkey performance](../lessons/258)

lessons/256/0-terraform/.terraform.lock.hcl

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
provider "aws" {
2+
region = "us-east-2"
3+
}
4+
5+
terraform {
6+
required_version = ">= 1.0"
7+
8+
required_providers {
9+
aws = {
10+
source = "hashicorp/aws"
11+
version = "~> 5.0"
12+
}
13+
}
14+
}

lessons/256/0-terraform/1-vpc.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
resource "aws_vpc" "main" {
2+
cidr_block = "10.0.0.0/16"
3+
4+
enable_dns_support = true
5+
enable_dns_hostnames = true
6+
7+
tags = {
8+
Name = "dev-main"
9+
}
10+
}

lessons/256/0-terraform/2-igw.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
resource "aws_internet_gateway" "igw" {
2+
vpc_id = aws_vpc.main.id
3+
4+
tags = {
5+
Name = "dev-igw"
6+
}
7+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
resource "aws_subnet" "public_zone1" {
2+
vpc_id = aws_vpc.main.id
3+
cidr_block = "10.0.0.0/19"
4+
availability_zone = "us-east-2a"
5+
map_public_ip_on_launch = true
6+
7+
tags = {
8+
"Name" = "dev-public-us-east-2a"
9+
"kubernetes.io/role/elb" = "1"
10+
"kubernetes.io/cluster/dev-demo" = "owned"
11+
}
12+
}
13+
14+
resource "aws_subnet" "public_zone2" {
15+
vpc_id = aws_vpc.main.id
16+
cidr_block = "10.0.32.0/19"
17+
availability_zone = "us-east-2b"
18+
map_public_ip_on_launch = true
19+
20+
tags = {
21+
"Name" = "dev-public-us-east-2b"
22+
"kubernetes.io/role/elb" = "1"
23+
"kubernetes.io/cluster/dev-demo" = "owned"
24+
}
25+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
resource "aws_route_table" "public" {
2+
vpc_id = aws_vpc.main.id
3+
4+
route {
5+
cidr_block = "0.0.0.0/0"
6+
gateway_id = aws_internet_gateway.igw.id
7+
}
8+
9+
tags = {
10+
Name = "dev-public"
11+
}
12+
}
13+
14+
resource "aws_route_table_association" "public_zone1" {
15+
subnet_id = aws_subnet.public_zone1.id
16+
route_table_id = aws_route_table.public.id
17+
}
18+
19+
resource "aws_route_table_association" "public_zone2" {
20+
subnet_id = aws_subnet.public_zone2.id
21+
route_table_id = aws_route_table.public.id
22+
}

0 commit comments

Comments
 (0)