This repository contains Terraform configurations to deploy the following infrastructure on AWS:
- VPC
- Public subnet
- Private subnet
- Internet gateway
- Route table
- Security group
- Bastion instance
- Application instance
- Key pair
- RDS instance
- ElastiCache Redis engine
This repository is organized into two folders:
basic-configuration
: contains the basic Terraform configuration to deploy the infrastructure.modules-configuration
: contains a modularized version of the Terraform configuration using modules and variables.- Inside
modules-configuration
, there is ases
folder, which contains screenshots of the SES service mail and the Lambda function. - Besides this configuration, there are two other configurations for an ElastiCache Redis engine and an RDS, and both of them are available under the
lab2/compute
module.
- Inside
Before using this Terraform configuration, you should have the following:
- Terraform CLI installed on your local machine.
- AWS account credentials configured.
Follow the steps below to use this Terraform configuration:
- Clone this repository to your local machine.
- Navigate to the
basic-configuration
ormodules-configuration
directory, depending on the configuration you want to use. - Run
terraform init
to initialize the configuration. - Run
terraform apply
to create the infrastructure on AWS. - When you're finished using the infrastructure, run
terraform destroy
to tear it down.
The following variables can be customized:
region
: The AWS region to create the infrastructure in (default:us-east-1
).vpc_cidr_block
: The CIDR block for the VPC (default:10.0.0.0/16
).public_subnet_cidr_block
: The CIDR block for the public subnet (default:10.0.1.0/24
).private_subnet_cidr_block
: The CIDR block for the private subnet (default:10.0.2.0/24
).bastion_instance_type
: The instance type for the bastion instance (default:t2.micro
).
This Terraform configuration supports multiple workspaces: prod
and dev
. The variables and configurations for each workspace are available via prod.tfvars
and dev.tfvars
, respectively.