
In this lecture, students are introduced to the network architecture that will serve as the foundation for the AWS environment built throughout the course. The lecture explains the purpose of an Amazon Virtual Private Cloud (VPC) and how it provides a logically isolated network where IP addressing, subnets, routing, and security controls can be designed.
Students learn how CIDR notation defines the IP address ranges available to the VPC and its subnets, and why careful IP address planning is important for creating non-overlapping subnet ranges while leaving capacity for future growth.
The lecture also explains the relationship between AWS Regions and Availability Zones and introduces the course's high-availability network design. The architecture uses two Availability Zones, with each AZ containing both a public subnet and a private subnet. Students learn how this design separates internet-facing resources from internal application and data workloads while reducing dependence on a single Availability Zone.
After completing this lecture, students will be able to explain the role of a VPC, interpret CIDR notation, plan subnet IP address ranges, distinguish Regions from Availability Zones, and design a multi-AZ VPC architecture using public and private subnets for network separation and high availability.
In this lecture, students move from network design concepts into Infrastructure as Code by learning how public and private AWS subnets are defined and created using Terraform. Rather than manually creating networking resources through the AWS Console, students examine how Terraform provides a repeatable, reviewable, and version-controlled approach to building the VPC subnet architecture.
Students learn how Terraform variables are used to supply CIDR blocks, Availability Zones, project settings, and environment-specific values to a reusable VPC module. They also examine how the architecture creates public and private subnets across multiple Availability Zones to establish the network foundation required for high availability.
The lecture explains the architectural purpose of each subnet tier. Public subnets provide the network tier for resources such as internet-facing Application Load Balancers, NAT Gateways, and Bastion Hosts, while private subnets provide isolation for application servers, databases, and other internal workloads that should not be directly exposed to the internet.
Students also learn why reusable Terraform modules are important for production infrastructure. By separating the architecture pattern from environment-specific configuration, the same VPC module can support different environments by changing input variables rather than rewriting infrastructure resources.
After completing this lecture, students will be able to define public and private AWS subnets with Terraform, organize subnets across multiple Availability Zones, configure subnet properties through reusable variables, explain which workloads belong in each subnet tier, and apply a reusable Terraform module approach to building consistent AWS network environments.
In this lecture, students learn how AWS routing components work together to provide network connectivity within a VPC and between the VPC and the internet. The lesson introduces the Internet Gateway, route tables, routes, and subnet associations that form the routing foundation of the production VPC architecture.
Students examine how an Internet Gateway (IGW) provides a path between the VPC and the public internet while learning that simply attaching an IGW does not automatically make resources publicly accessible. They explore how route tables determine where subnet traffic is directed and how individual routes combine a destination CIDR with a target such as the local VPC, an Internet Gateway, or a NAT Gateway.
The lecture walks through the important routing distinction between public and private subnets. Students learn how the local route supports communication within the VPC, how a 0.0.0.0/0 → Internet Gateway route provides an internet path for public subnets, and why private subnets do not route directly to the Internet Gateway.
Students also learn why subnet-to-route-table associations are essential and examine how Terraform can define the Internet Gateway, route tables, routes, and subnet associations as Infrastructure as Code, making the complete routing architecture consistent, reviewable, and repeatable.
After completing this lecture, students will be able to explain how Internet Gateways, route tables, routes, and subnet associations work together; distinguish public and private subnet routing; interpret common AWS routes such as 0.0.0.0/0; and understand how Terraform is used to implement a repeatable VPC routing architecture.
In this lecture, students learn how NAT Gateways provide controlled outbound internet connectivity for resources running in private AWS subnets. The lesson focuses on an important production networking principle: private workloads may need access to the internet for updates, downloads, or external services without becoming directly accessible from the public internet.
Students examine the traffic path from a private subnet through a NAT Gateway and Internet Gateway to the internet. They learn why a public NAT Gateway is placed in a public subnet, how an Elastic IP address provides its public IPv4 identity, and how the private subnet's 0.0.0.0/0 route directs internet-bound traffic to the NAT Gateway rather than directly to an Internet Gateway.
The lecture also explains how return traffic is translated back to the originating private resource while preventing arbitrary internet hosts from initiating connections to those private instances. Students then examine the course's production-style high-availability NAT architecture, where each Availability Zone has its own NAT Gateway and each private subnet routes through the NAT Gateway in its local AZ. The associated availability-versus-cost consideration is also discussed.
Finally, students see how Terraform can define the NAT Gateways, Elastic IP addresses, private route tables, routes, and subnet associations as a coordinated Infrastructure as Code solution.
After completing this lecture, students will be able to explain how NAT Gateways provide outbound internet access while keeping workloads private, trace traffic from a private subnet to the internet, configure the required routing architecture, explain the role of Elastic IPs, design a multi-AZ NAT Gateway strategy, and understand how Terraform implements the complete private-subnet internet access pattern.
In this lecture, students learn how AWS Security Groups provide stateful, resource-level network protection and how they are used to implement layered access control within the production VPC architecture. Students examine how inbound and outbound rules control permitted protocols, ports, sources, and destinations while applying the principle of least privilege.
The lecture introduces a layered security architecture using separate Security Groups for the Application Load Balancer, application tier, database tier, and Bastion Host. Students learn why application instances should not be directly exposed to the internet and how traffic can instead follow a controlled path from the internet through the ALB Security Group and then to the application Security Group.
Students also explore Security Group references, which allow one Security Group to be used as the source for another. This enables architectural relationships such as permitting application traffic specifically from resources associated with the ALB Security Group rather than relying on fixed IP addresses.
The lecture connects Security Groups to the broader concept of defense in depth, showing how they complement subnet placement, routing, Network ACLs, WAF, and other security controls. Students also see how Security Groups and their rules can be defined with Terraform, making network security policies repeatable, reviewable, version-controlled, and less susceptible to configuration drift.
After completing this lecture, students will be able to explain stateful Security Group behavior, configure inbound and outbound access rules, apply least-privilege principles, design separate Security Groups for architectural tiers, use Security Group references to control traffic between tiers, and understand how Terraform is used to implement layered AWS network security.
In this lecture, students compare two important layers of AWS network security: Security Groups (SGs) and Network Access Control Lists (NACLs). Students learn how these controls operate at different levels of the VPC architecture and how they can work together to provide defense in depth.
The lecture explains that Security Groups are stateful and are associated with supported resources and network interfaces, while Network ACLs are stateless and operate at the subnet boundary. Students examine how this difference affects inbound and outbound traffic, including why return traffic is automatically permitted for an allowed Security Group connection while NACLs evaluate traffic in both directions.
Students also learn an important difference in rule behavior: Security Groups use allow rules, while NACLs can explicitly allow or deny traffic. The lecture examines how NACL rules are processed in ascending numerical order until a matching rule is found, demonstrating why rule ordering must be carefully considered when designing subnet-level security policies.
The lesson then places both controls within the larger AWS security architecture. Students see how Security Groups provide resource-level protection while NACLs provide subnet-level protection, complementing subnet placement, routing, WAF, and other security mechanisms. Students also examine how Terraform can define NACLs, rules, and subnet associations as repeatable and reviewable Infrastructure as Code.
After completing this lecture, students will be able to distinguish Security Groups from Network ACLs, explain stateful versus stateless filtering, identify resource-level versus subnet-level protection, understand allow and deny behavior, interpret NACL rule processing, and explain how both controls can be combined with Terraform as part of a layered AWS network security architecture.
In this final theory lecture, students learn how a Bastion Host provides a controlled administrative entry point for accessing resources located in private AWS subnets. Rather than assigning public access to private EC2 instances, administrators first connect to the Bastion Host and then access authorized private resources from within the VPC.
Students examine why the Bastion Host is placed in a public subnet while application and data workloads remain protected in private subnets. The lecture emphasizes that public placement does not mean unrestricted access: administrative connections should be limited to trusted source addresses and only the required ports.
The lecture also introduces Security Group chaining, where private EC2 instances permit SSH access from the Bastion Host Security Group rather than directly from the internet. This reinforces the principles of least privilege and layered access control developed throughout the network security section.
Students then place the Bastion Host within the broader defense-in-depth architecture, where subnet separation, routing, Security Groups, NACLs, IAM, and monitoring work together to protect administrative access. The lecture concludes by showing how the Bastion Host and its networking and security configuration can be provisioned with Terraform as Infrastructure as Code.
After completing this lecture, students will be able to explain the purpose and traffic flow of a Bastion Host architecture, determine appropriate public and private subnet placement, apply least-privilege SSH access, use Security Group chaining to protect private EC2 instances, and explain how a Bastion Host fits into a defense-in-depth AWS network architecture.
With this lecture, students have completed the networking theory portion of the course and are ready to transition into the hands-on implementation phase, where they will apply these VPC, subnet, routing, internet connectivity, and network security concepts using Terraform.
In this lecture, students begin the hands-on implementation of the production AWS network by examining the Terraform code used to create the Virtual Private Cloud (VPC).
We walk through the aws_vpc resource in modules/vpc/main.tf and explain how the VPC CIDR block is supplied through reusable Terraform variables. Students also learn why DNS support and DNS hostnames are enabled and how consistent resource tagging helps identify and organize infrastructure across projects and environments.
The lecture reinforces the relationship between Terraform variables, reusable modules, and AWS resources, establishing the VPC as the network foundation for the public and private subnets that follow.
After completing this lecture, students will be able to:
Define an AWS VPC using Terraform.
Configure the VPC CIDR block using input variables.
Enable DNS support and DNS hostnames.
Apply consistent metadata and resource tags.
Explain how the VPC resource forms the foundation of the reusable networking module.
In this lecture, students continue the hands-on construction of the production AWS network by implementing the public and private subnet architecture within the VPC using Terraform.
We walk through the Terraform resources used to dynamically create public and private subnets across multiple Availability Zones. Students learn how for_each eliminates the need to duplicate subnet resource blocks by creating multiple subnet instances from configurable input maps.
The lecture examines how each.key identifies the Availability Zone for each subnet while each.value supplies the subnet number used in the CIDR calculation. Students also explore Terraform's cidrsubnet() function and see how it derives non-overlapping subnet CIDR ranges from the parent VPC address space.
We then compare the public and private subnet configurations, including the use of map_public_ip_on_launch for public subnets. The walkthrough also demonstrates how consistent naming conventions and resource tags identify each subnet's role, environment, project, and Availability Zone.
This implementation establishes the multi-AZ public and private subnet foundation that later networking components will use for internet connectivity, routing, and workload isolation.
After completing this lecture, students will be able to:
Create public and private AWS subnets using Terraform.
Dynamically provision multiple subnets using for_each.
Explain how each.key and each.value are used when iterating over subnet maps.
Use cidrsubnet() to derive subnet CIDR ranges from the VPC CIDR block.
Distribute public and private subnets across multiple Availability Zones.
Configure automatic public IPv4 address assignment for public subnets.
Reference the parent VPC when creating subnet resources.
Apply consistent naming conventions and metadata tags to subnet resources.
Explain how a multi-AZ public/private subnet design prepares the VPC for the routing and connectivity components implemented later in the course.
In this lecture, students extend the VPC architecture by implementing the internet connectivity and routing infrastructure required by the public and private subnets.
We begin by creating an Internet Gateway and attaching it to the VPC, establishing the gateway that the public network will use for internet connectivity. Students then create Elastic IP addresses and NAT Gateways for the public subnets. Using for_each, Terraform dynamically creates these resources across the Availability Zones and maintains the relationship between each public subnet, Elastic IP address, and NAT Gateway.
Next, we build the public and private route tables. A shared public route table is created for the public subnets, while separate private route tables are dynamically created for the private subnets. This supports an Availability Zone-aware design in which each private subnet can route outbound traffic through its corresponding NAT Gateway.
The lecture then configures the default 0.0.0.0/0 routes. Public subnet traffic is directed toward the Internet Gateway, while private subnet outbound traffic is directed through the appropriate NAT Gateway.
Finally, students associate the route tables with their respective subnets, completing the connectivity and routing relationships:
Public Subnet → Public Route Table → Internet Gateway → Internet
Private Subnet → Private Route Table → NAT Gateway → Internet Gateway → Internet
After completing this lecture, students will be able to:
Create and attach an Internet Gateway to an AWS VPC using Terraform.
Provision Elastic IP addresses for NAT Gateways.
Dynamically create NAT Gateways across public subnets using for_each.
Explain how each.key maintains relationships between Availability Zone-specific resources.
Use Terraform resource references to connect Elastic IPs, NAT Gateways, subnets, and route tables.
Use depends_on to explicitly define the required Internet Gateway dependency.
Create a shared route table for public subnets.
Create separate private route tables across multiple Availability Zones.
Configure 0.0.0.0/0 routes through an Internet Gateway or NAT Gateway.
Associate public and private subnets with their appropriate route tables.
Trace the outbound traffic path for resources located in public and private subnets.
In this lecture, students continue securing the production VPC by implementing public and private Security Groups using Terraform. The walkthrough demonstrates how Security Groups provide resource-level traffic controls and how Terraform can define individual ingress and egress rules as separate infrastructure resources.
We begin by creating the public Security Group and associating it with the VPC. Students then configure an outbound rule that permits resources using the Security Group to initiate traffic to external destinations.
Next, we implement inbound rules for three common protocols: SSH on TCP port 22, HTTP on TCP port 80, and HTTPS on TCP port 443. Rather than hard-coding the permitted source networks directly into the rules, the configuration uses Terraform variables such as allowed_ssh_cidr, allowed_http_cidr, and allowed_https_cidr. This keeps the networking module reusable and allows access policies to be configured for different deployment environments.
The lecture then introduces a separate private Security Group for resources that will operate within the private portion of the VPC. An outbound rule is configured for the private Security Group while no inbound internet-facing rules are defined in this portion of the configuration, establishing a foundation for more restrictive access to private workloads.
Throughout the walkthrough, students also see how Terraform resource references connect security-group rules to their corresponding Security Groups and how consistent tags identify each Security Group's role within the architecture.
After completing this lecture, students will be able to:
Create public and private AWS Security Groups using Terraform.
Associate Security Groups with the appropriate VPC.
Define ingress and egress rules as separate Terraform resources.
Configure SSH access using TCP port 22.
Configure HTTP and HTTPS access using TCP ports 80 and 443.
Use Terraform variables to configure permitted source CIDR ranges.
Configure outbound access for public and private Security Groups.
Reference Security Group IDs from Terraform rule resources.
Explain the difference between the public and private Security Group configurations used in this architecture.
Apply consistent naming conventions and metadata tags to Security Group resources.
In this lecture, students add another layer of security to the production VPC by implementing public and private Network Access Control Lists (NACLs) and configuring the Application Load Balancer Security Group using Terraform.
We begin by creating the public Network ACL and defining ordered inbound rules for SSH, HTTP, and HTTPS traffic. Students also examine the ephemeral TCP port range of 1024–65535, which is included to support return traffic through the stateless Network ACL. An outbound rule is then configured to permit traffic leaving the public subnets.
The public NACL is dynamically associated with each public subnet using for_each, demonstrating how a single Terraform configuration can consistently apply subnet-level security controls across multiple Availability Zones.
Next, students create the private Network ACL. The configuration permits inbound communication originating from within the VPC CIDR and allows outbound traffic to external destinations. The private NACL is then dynamically associated with each private subnet.
The lecture then moves to the Application Load Balancer Security Group. Students configure HTTP and HTTPS ingress rules for the internet-facing ALB along with its outbound traffic rule.
Finally, we implement an important application-tier security control: the private Security Group accepts HTTP traffic on port 80 specifically from the ALB Security Group. Using source_security_group_id instead of an internet CIDR range restricts the intended application path so that private application resources receive web traffic through the load balancer rather than directly from the internet.
This completes the layered security model:
Internet → Public Network Controls → ALB → Private Application Resources
Students also reinforce an important architectural distinction: Security Groups are stateful resource-level controls, while Network ACLs are stateless subnet-level controls. Together, they provide complementary layers of protection within the VPC.
After completing this lecture, students will be able to:
Create public and private Network ACLs using Terraform.
Configure ordered NACL rules using rule_no.
Define inbound rules for SSH, HTTP, HTTPS, and ephemeral TCP ports.
Configure outbound NACL traffic rules.
Associate Network ACLs with multiple subnets using for_each.
Configure a private NACL using the VPC CIDR as an allowed source.
Create a dedicated Security Group for an internet-facing Application Load Balancer.
Configure HTTP and HTTPS ingress rules for the ALB.
Configure outbound traffic from the ALB Security Group.
Use source_security_group_id to allow traffic from one Security Group to another.
Restrict private application-tier HTTP access to traffic originating from the ALB.
Explain how Security Groups and Network ACLs work together to provide layered VPC security.
In this final hands-on lecture of Class B, students bring together everything developed throughout the course and deploy the completed AWS networking architecture.
We begin by integrating the reusable VPC child module into the root main.tf configuration. Students see how root-level variables for the AWS Region, VPC CIDR, project metadata, environment, and public/private subnet definitions are passed into the VPC module. This reinforces the separation between the root module, which configures the deployment, and the reusable VPC module, which defines how the network is constructed.
With the module integrated, we move through the Terraform deployment workflow. Students initialize the project, validate the Terraform configuration, generate an execution plan, and inspect the plan before making changes to AWS. This demonstrates why reviewing Terraform's proposed infrastructure changes is an important step before deployment.
We then execute the Terraform apply process and compare the AWS Management Console before and after deployment to verify that Terraform successfully provisioned the networking resources defined throughout the course.
Finally, students perform a controlled terraform destroy, observe Terraform's proposed resource removals, and verify that the lab infrastructure is removed from AWS. This reinforces the complete Infrastructure as Code lifecycle—from definition and planning through deployment, verification, and cleanup.
After completing this lecture, students will be able to:
Integrate a reusable VPC module into a root Terraform configuration.
Pass root-module variables into a child module.
Explain the relationship between root and child Terraform modules.
Initialize and validate a Terraform project.
Generate and inspect a Terraform execution plan before deployment.
Apply a Terraform configuration to provision AWS networking infrastructure.
Verify provisioned resources using the AWS Management Console.
Compare the AWS environment before and after Terraform deployment.
Use terraform destroy to safely remove lab infrastructure.
Explain the complete Terraform workflow from configuration through deployment and cleanup.
Class B Closing / Transition to Class C
This lecture completes Class B: AWS Networking – Production VPC Architecture. Students have progressed from designing the network to expressing that architecture as reusable Terraform code and ultimately provisioning and validating it in AWS.
With the networking foundation established, we are ready to begin Class C: IAM, S3 & Event-Driven Serverless Architecture, where we will add identity and access management, cloud storage, and event-driven processing capabilities to our growing production architecture.
Terraform & AWS Networking: VPC Architecture – Course 2 of 9 (Class B) is a hands-on course designed to teach students how to design, build, secure, and deploy a production-style AWS networking foundation using Terraform Infrastructure as Code (IaC).
Rather than focusing only on AWS networking theory, this course combines architectural concepts with practical Terraform implementation. Students progressively construct a multi-Availability Zone Amazon VPC architecture containing public and private subnets while learning how the major AWS networking components work together.
The course begins with VPC and CIDR planning, including subnet design and the separation of public and private network tiers. Students then use Terraform to create reusable networking infrastructure across multiple Availability Zones.
From there, the course introduces Internet Gateways, Elastic IP addresses, NAT Gateways, route tables, routes, and subnet associations. Students learn how public resources communicate with the internet and how resources within private subnets can obtain controlled outbound internet connectivity through NAT Gateways.
Security is incorporated directly into the architecture. Students implement Security Groups and Network ACLs (NACLs) to establish layered network protection, configure SSH, HTTP, HTTPS, and outbound traffic rules, and explore the differences between stateful Security Groups and stateless Network ACLs. The course also introduces an Application Load Balancer security pattern, including restricting private application traffic so that it can originate from the ALB Security Group.
Throughout the hands-on portion, students work with reusable Terraform modules and important Terraform concepts such as variables, for_each, resource references, dependencies, cidrsubnet(), and consistent resource tagging.
Finally, students integrate the networking module into the root Terraform configuration and perform the complete deployment lifecycle using Terraform init, validation, planning, plan inspection, apply, AWS Console verification, and destroy.
By the end of this course, students will have built and deployed a reusable AWS VPC networking foundation that prepares them for (Class C) Course 3: IAM, S3 & Event-Driven Serverless Architecture and the additional infrastructure components that will be added throughout the 9-course series.