This repository contains Terraform code for provisioning a foundational AWS infrastructure, including a VPC, subnets, and an EC2 instance designed for hosting a web service with Nginx.
This project automates the creation of a secure and scalable AWS infrastructure using Terraform. It focuses on provisioning a VPC with segregated public and private subnets across multiple availability zones and deploying an EC2 instance configured for Nginx.
- Scalability: Support scaling within AWS by leveraging multiple availability zones.
- Security: Ensure a high level of security by isolating resources within private subnets where appropriate.
- Automation: Fully automate infrastructure provisioning to ensure repeatability and reduce manual errors.
modules/
: Contains reusable Terraform modules for VPC, subnets, and EC2 instance provisioning.main.tf
: Orchestrates the module usage and ties together the infrastructure components.variables.tf
: Defines variables for customizing the Terraform configuration.outputs.tf
: Specifies output variables that are useful for querying and integrating with the provisioned resources.providers.tf
: Configures the Terraform providers and authentication.
- Terraform >= 0.12
- AWS CLI configured with Administrator access
- An AWS account and your AWS credentials configured
- Initialize Terraform: Run
terraform init
in the root directory to initialize Terraform with the necessary providers. - Plan Deployment: Execute
terraform plan
to review the changes that will be made to your AWS environment. - Apply Configuration: Run
terraform apply
to apply the configuration and provision your AWS infrastructure.
The VPC module provisions a Virtual Private Cloud to host all the resources, ensuring they are isolated and secure.
This module creates public and private subnets across multiple availability zones for high availability and isolation.
Provisions an EC2 instance within the public subnet, configured to host an Nginx server, accessible over HTTP.