https://github.com/5h1ngy/infra-terraform-aws
Automated AWS infrastructure with Terraform: deploy VPC, EC2, Route53 DNS, and Nginx/Docker setups for frontend services. Includes scripts, templates, and detailed documentation
https://github.com/5h1ngy/infra-terraform-aws
aws aws-ec2 aws-vpc backend cloud devops docker frontend infrastructure infrastructure-as-code microservices nginx route53 terraform
Last synced: 6 months ago
JSON representation
Automated AWS infrastructure with Terraform: deploy VPC, EC2, Route53 DNS, and Nginx/Docker setups for frontend services. Includes scripts, templates, and detailed documentation
- Host: GitHub
- URL: https://github.com/5h1ngy/infra-terraform-aws
- Owner: 5h1ngy
- License: mit
- Created: 2024-12-18T20:58:58.000Z (10 months ago)
- Default Branch: develop
- Last Pushed: 2025-02-03T16:17:02.000Z (8 months ago)
- Last Synced: 2025-02-13T09:28:04.491Z (8 months ago)
- Topics: aws, aws-ec2, aws-vpc, backend, cloud, devops, docker, frontend, infrastructure, infrastructure-as-code, microservices, nginx, route53, terraform
- Language: HCL
- Homepage:
- Size: 846 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# **Infra Terraform AWS**
![]()
[](./LICENSE)
[](#)

A Terraform-based infrastructure project deploying AWS VPC, EC2 instances, Route53 DNS records, and setting up Nginx & Docker for serving frontends. This project focuses on scalability, modularity, and providing a reproducible environment setup.
![]()
## **Table of Contents**
- [Introduction](#introduction)
- [Features](#features)
- [Requirements](#requirements)
- [Installation](#installation)
- [Usage](#usage)
- [Project Structure](#project-structure)
- [Key Dependencies](#key-dependencies)
- [Testing](#testing)
- [License](#license)
- [Contributing](#contributing)
- [Contact](#contact)## **Introduction**
**Infra Terraform AWS** is designed to provision a ready-to-use AWS infrastructure:
- A VPC with subnets, routing, and security groups.
- An EC2 instance serving a frontend application via Nginx and Docker.
- Route53 DNS records pointing your domain to the EC2 instance.This infrastructure allows you to quickly spin up a controlled environment for your web services.
## **Features**
- ✅ Automated infrastructure deployment with Terraform
- ✅ Configurable AWS credentials and parameters via `terraform.tfvars`
- ✅ Easy start/stop with provided shell scripts (deploy/destroy/reset)
- ✅ Nginx + Docker setup for serving frontend static files
- ✅ Route53 DNS integration## **Requirements**
- **Terraform**: `>= 1.0.0`
- **AWS CLI** (optional for testing and debugging)
- **Node.js** and **Yarn** are required if you plan to build or manage frontend assets (not strictly required for pure infrastructure deployment).## **Installation**
### Steps
1. Clone the repository:
```bash
git clone https://github.com/5h1ngy/infra-terraform-aws.git
cd infra-terraform-aws
```2. Copy and rename the example files for sensitive data:
```bash
cp examples/terraform.tfvars.example terraform/terraform.tfvars
cp examples/ssh-keys/id_rsa_terraform.example data/ssh/id_rsa_terraform
cp examples/ssh-keys/id_rsa_terraform.pub.example data/ssh/id_rsa_terraform.pub
```
Edit `terraform/terraform.tfvars` to insert your AWS credentials and config.
*Do not commit these files with real credentials.*3. (Optional) If using AWS CLI:
```bash
cp examples/aws-credentials.example .env
```
Update `.env` with your AWS keys and load them into your environment before using AWS CLI.4. Initialize Terraform and apply:
```bash
cd terraform
terraform init
terraform validate
terraform plan
terraform apply -auto-approve
```## **Usage**
- **deploy.sh**: Deploys the infrastructure, runs `terraform apply`.
- **destroy.sh**: Destroys all Terraform-managed resources.
- **reset.sh**: Removes local Terraform state and output files, allowing a clean re-apply.
- **nuke.sh**: **Dangerous!** Removes almost all major AWS resources in the account. Use with caution.You can find these scripts in the `scripts/` directory.
## **Project Structure**
```plaintext
infra-terraform-aws/
├── .gitignore
├── README.md
├── examples/
│ ├── terraform.tfvars.example
│ ├── aws-credentials.example
│ └── ssh-keys/
│ ├── id_rsa_terraform.example
│ └── id_rsa_terraform.pub.example
├── scripts/
│ ├── deploy.sh
│ ├── destroy.sh
│ ├── reset.sh
│ └── nuke.sh
└── terraform/
├── provider.tf
├── variables.tf
├── terraform.tfvars # not committed, created from .example
├── networking.tf
├── compute.tf
├── security.tf
├── dns.tf
├── output.tf
└── data/
├── ssl/ # SSL certificates (not committed)
├── templates/ # Nginx, Docker-compose templates
├── services/ # Service artifacts (e.g., frontend.zip)
└── ssh/ # SSH keys (not committed)
```## **Key Dependencies**
- **Terraform**: Infrastructure as Code tool
- **AWS Provider for Terraform**: Manages AWS resources
- **Nginx**, **Docker**, **Docker Compose**: Provisioned on the EC2 instance to serve the frontendFor detailed dependencies and versions, see individual `.tf` files and scripts.
## **Testing**
Infrastructure testing can be done using:
- **terraform plan**: to ensure no unexpected changes.
- **aws cli**: to verify resources, e.g. `aws ec2 describe-instances`.There is no direct unit-testing framework integrated for infrastructure. For frontend testing, integrate with your CI/CD pipeline after deployment.
## **License**
This project is licensed under the [MIT License](./LICENSE).
## **Contact**
- **Repository**: [https://github.com/5h1ngy/infra-terraform-aws.git](https://github.com/5h1ngy/infra-terraform-aws.git)
- **Author**: [5h1ngy](https://github.com/5h1ngy)