Infra & Cloud terraform Advanced

AWS VPC with Public and Private Subnets

Terraform VPC module with NAT gateway, route tables and subnet tagging for EKS.

terraform
module "vpc" {
  source  = "terraform-aws-modules/vpc/aws"
  version = "~> 5.0"

  name = "myapp-vpc"
  cidr = "10.0.0.0/16"

  azs             = ["us-east-1a", "us-east-1b"]
  private_subnets = ["10.0.1.0/24", "10.0.2.0/24"]
  public_subnets  = ["10.0.101.0/24", "10.0.102.0/24"]

  enable_nat_gateway = true
  single_nat_gateway = true

  tags = { Environment = var.env }
}

Prerequisites

  • terraform >= 1.0
  • AWS provider
  • terraform-aws-modules/vpc

Pro Tips

  • → Use single_nat_gateway=false for HA in production.

Was this module useful?

Share your experience — it helps the team improve.

Leave Feedback

Commercial Licensing

Acquire a production access token or template license for enterprise deployment.

Module Info

Language
terraform
Level
Advanced
Read time
5 min
Published
Jul 2026
License
Commercial License

Newsletter

New modules every week, directly to your inbox.