Cloud Architecture Design and Deployment with Terraform

Secure and scalable cloud infrastructure with Public, Private, and Secure subnets

Cloud Architecture Diagram

Project Overview

Designed and deployed a secure and scalable cloud architecture using Terraform, featuring three subnet types: Public, Private, and Secure. This architecture includes a highly available Load Balancer, an Auto Scaling Group (ASG) for the application tier, and a secure RDS instance for the database tier. Additionally, VPC Flow Logs were enabled for monitoring and troubleshooting. The infrastructure was built using a custom golden VM image created with Packer for consistent deployments.

Architecture Components

1. Subnet Design

The architecture implements a three-tier subnet strategy for optimal security and connectivity:

  • Public Subnets: Routes traffic through an Internet Gateway for inbound and outbound internet access.
  • Private Subnets: Utilizes a NAT Gateway for secure outbound internet access while blocking inbound internet traffic.
  • Secure Subnets: Completely isolated from both Internet Gateway and NAT Gateway, ensuring maximum security for sensitive resources.

2. Load Balancer

Key features of the load balancing solution:

  • Deployed in Public subnets across two Availability Zones (AZs) for high availability
  • Configured with listeners and target groups to route traffic to the application tier
  • Implements health checks to ensure traffic only reaches healthy instances

3. Auto Scaling Group (ASG)

The application tier deployment strategy:

  • Deployed in Private subnets across two AZs
  • Ensures no public IPs are assigned to instances
  • Access enabled via AWS Systems Manager (SSM) for secure management
  • Configured with desired, minimum, and maximum instance counts set to 1 for cost optimization
  • Uses custom golden AMI created with Packer for consistent deployments

4. RDS Database

Secure database implementation:

  • Deployed in the Secure subnet to reduce costs and enhance security
  • Configured for restricted access, allowing only the application tier to communicate with the database
  • Multi-AZ deployment option available for production environments

5. Monitoring and Troubleshooting

Implemented comprehensive monitoring:

  • Enabled VPC Flow Logs to capture and analyze application traffic
  • CloudWatch metrics for performance monitoring
  • Configured alarms for critical events

Key Features

Security Implementation

Multiple security layers implemented:

  • Network segmentation with Public, Private, and Secure subnets
  • Security groups with least-privilege access rules
  • No public IPs assigned to application or database instances
  • Secure access to instances via AWS Systems Manager
  • Database tier completely isolated from internet

High Availability

Designed for fault tolerance:

  • Load Balancer distributed across multiple AZs
  • Auto Scaling Group spans multiple AZs
  • Option for Multi-AZ RDS deployment
  • Stateless application design for horizontal scaling

Infrastructure as Code

Terraform implementation details:

  • Modular design for reusable components
  • Variables for environment-specific configurations
  • State management with remote backend
  • Version-controlled infrastructure definitions
  • Automated provisioning workflow

Golden Image with Packer

Custom VM image benefits:

  • Consistent environment for all deployments
  • Pre-configured with necessary software and security patches
  • Reduced deployment time
  • Versioned images for rollback capability
  • Automated build process

Architecture Diagram

Cloud Architecture Diagram
Cloud Architecture with Public, Private, and Secure Subnets

Key Achievements

  • Designed and implemented a secure three-tier cloud architecture
  • Automated infrastructure deployment using Terraform
  • Created custom golden images with Packer for consistent deployments
  • Implemented proper network segmentation for security
  • Configured high availability components (Load Balancer, ASG)
  • Enabled comprehensive monitoring with VPC Flow Logs
  • Deployed PetClinic Java-based application in the architecture
  • Documented the infrastructure design and deployment process

Work Samples

Terraform Configuration

Terraform Screenshots

2 images