📌 AWS 3 tier architecture with LBs, ASG and RDS
Tags: aws, infrastructureascode, design
Published: 2024-02-01 17:00:00

## ❶ Description 📝

This infrastructure is designed for fault tolerance and high availability, using multiple availability zones and auto-scaling features.

## ❷ Architecture components 🏛️

### **VPC and Networking**

- **`aws_vpc`**: The foundational networking component that provides a private, isolated section of the AWS cloud where you can launch AWS resources in a virtual network that you define.
- **`aws_subnet`**: Subdivides your VPC into smaller networks. Each subnet is in a specific availability zone and is used to isolate and control traffic flow for the web, app, and database tiers.
- **`aws_internet_gateway`**: Connects the VPC to the internet, allowing communication between instances in your VPC and the internet.
- **`aws_nat_gateway`**: Used to enable instances in a private subnet to connect to the internet or other AWS services while preventing incoming internet connections.

### **Auto Scaling and Load Balancing**

- **`aws_autoscaling_group`**: Manages a group of EC2 instances, automatically adjusting the number of instances to maintain consistent performance and handle loads efficiently.
- **`aws_elb`** (Elastic Load Balancer): Automatically distributes incoming application traffic across multiple targets, such as EC2 instances, ensuring high availability and fault tolerance.

### **DNS and WAF**

- **`aws_route53_zone`** and **`aws_route53_record`**: Route 53 is Amazon’s DNS service, managing domain names and translating friendly domains into IP addresses (**`A`** and **`CNAME`** records).
- **`aws_waf_web_acl`**, **`aws_waf_rule`**, **`aws_waf_ipset`**: AWS WAF protects your web applications from common web exploits and bots that could affect application availability, compromise security, or consume excessive resources.

### **Database and Storage**

- **`aws_db_subnet_group`**: Defines subnets for your database cluster in RDS to operate across different availability zones for fault tolerance.
- **`aws_rds_cluster`**: An Amazon Aurora PostgreSQL-compatible edition cluster provides enhanced performance and scalability for database operations.
- **`aws_s3_bucket`** and **`aws_s3_bucket_versioning`**: Defines an S3 bucket for object storage, with versioning enabled to preserve, retrieve, and restore every version of every object stored in your Amazon S3 bucket.

### **Elastic IPs and Launch Templates**

- **`aws_eip`** (Elastic IP): Provides a static IPv4 address for dynamic cloud computing, allowing you to manage the public IP of your instances.
- **`aws_launch_template`**: Provides a template for launching EC2 instances, ensuring that every instance launched has the same configuration.

🛡️ Once you clone this architecture from the template catalog, you can also scan it with the native CI/CD engine to know its security posture, its cost, before you deploy it.

😍Also, when you communicate with your colleagues, it’s much easier to show the architecture and explain. Not everyone is a Terraform guru.

🚀 You can get it here: [https://app.brainboard.co](https://app.brainboard.co/).


![Readme](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/glm5agwq5ismc8nm7sjk.png)


![CI/CD](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c0rjrc8lyvbmuooy3r9y.png)


![Drift](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zlpwsc9ytresvo368nuf.png)


![Variables](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/58dpco48buwci5tvc7zf.png)