This project provides both AWS CloudFormation and Terraform templates for creating a highly resilient Virtual Private Cloud (VPC) architecture across three Availability Zones (AZs). The templates include a well-structured network layout featuring public, NAT, and private subnets, along with the necessary routing components.
- Highly Resilient Architecture: Utilizes multiple Availability Zones (3 AZs) to ensure high availability and fault tolerance.
- Public, NAT, and Private Subnets: Configures public subnets for internet-facing resources, private NAT subnets for secure outbound internet access, and private subnets for internal resources.
- NAT Gateways: Deploys NAT gateways across multiple Availability Zones (AZs) to ensure high availability.
- Flexible Configuration: Allows customization of CIDR blocks, subnet sizes, and availability zones through parameters.
- Network ACLs: Implements Network Access Control Lists (NACLs) for added security at the subnet level.
- An AWS account with necessary permissions to create VPCs, subnets, NAT gateways, and other related resources.
- AWS CLI.
- Terraform (latest version recommended).
-
Clone the repository:
git clone https://github.com/alonshrestha/aws-vpc-resilient-architecture.git cd aws-vpc-resilient-architecture/cloudformation
-
Update Parameters: Modify the
parameters.json
file to set the desired values for your project, including:ProjectName
: Your project name.Environment
: Environment type (e.g., dev, staging, production).VpcCidr
: CIDR block for the VPC.PublicSubnets
,PrivateNatSubnets
,PrivateSubnets
: CIDR blocks for subnets.AvailabilityZones
: List of available AZs.
-
Deploy the CloudFormation Stack:
- Using the AWS CLI:
aws cloudformation create-stack --stack-name YourStackName --template-body file://vpc.yaml --parameters file://parameters.json
- Using the AWS CLI:
-
Monitor Stack Creation: Monitor the progress of the stack creation in the AWS Management Console.
-
Clone the repository (if you haven't already):
git clone https://github.com/alonshrestha/aws-vpc-resilient-architecture.git cd aws-vpc-resilient-architecture/terraform
-
Update Variables: Modify the
dev.tfvars
file to set the desired values for your project, including:projectName
: Your project name.environment
: Environment type (e.g., dev, staging, production).vpcCIDR
: CIDR block for the VPC.publicSubnetsCIDRList
,privateNatSubnetsCIDRList
,privateSubnetsCIDRList
: CIDR blocks for subnets.subnetsAZList
: List of available AZs.
-
Initialize Terraform: Run the following command to initialize the working directory:
terraform init
-
Plan the Infrastructure: Generate an execution plan to preview changes:
terraform plan -var-file="dev.tfvars"
-
Deploy the Infrastructure: Apply the configuration to create the resources:
terraform apply -var-file="dev.tfvars"
-
Monitor Creation: Monitor the progress in the Terraform output.
Feel free to customize the templates as per your requirements. You can add additional resources like EC2 instances, RDS databases, and more.
- Review and modify NACL rules based on your security requirements.
Contributions are welcome! Please open an issue or submit a pull request for any improvements or enhancements.
This project is licensed under the MIT License. See the LICENSE file for details.
- AWS Documentation
- CloudFormation and Terraform Template Examples