Skip to content

GhValentina/aws-infra-bostongene-task

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AWS Infrastructure Deployment

Overview

This repository contains Terraform code for deploying an AWS infrastructure environment as part of the BostonGene task.

Features:

  • VPC with public and private subnets
  • Application Load Balancer (ALB) connected to ECS instances
  • ECS Cluster with tasks running the http-echo application
  • RDS PostgreSQL 17 instance for database services
  • Corresponding Security Groups and IAM Roles for resource access control

Prerequisites

Before applying this Terraform infrastructure, ensure you have the following:

  1. AWS Account with the necessary permissions to create resources.
  2. Terraform installed on your local machine.
  3. SSH Key Pair:
    • Create an SSH key pair to use with the EC2 instances:
      aws ec2 create-key-pair --key-name APP_NAME --query 'KeyMaterial' --output text > APP_NAME.pem
      chmod 400 APP_NAME.pem
    • Ensure the private key file (APP_NAME.pem) is securely stored.
  4. Terraform Variables:
    • All environment-specific values should be provided in the terraform.tfvars file. This file is not included in the repository and must be provided separately.

Setting Up Environment Variables

Define your environment-specific values in terraform.tfvars. Below is an example configuration:

environment           = "dev"
region               = "us-east-1"
instance_type        = "t3.micro"
...

Usage

  1. Clone the Repository:

    git clone <repository_url>
    cd <repository_directory>
  2. Initialize Terraform:

    terraform init
  3. Plan the Changes:

    terraform plan
  4. Apply the Configuration:

    terraform apply
    • Type yes to confirm when prompted.
  5. Verify the Setup:

    • Access the ALB DNS name (output from Terraform) to verify the web application.
    • Use the RDS endpoint (output from Terraform) to validate database connectivity.

Cleanup

To destroy all resources and clean up the environment:

terraform destroy

Type yes to confirm.

Repository Structure

.
├── main.tf                 # root file
├── variables.tf            # main variables file
├── outputs.tf              # main outputs file
├── terraform.tfvars        # environment variable values (not included in the repository)
├── modules/                # reusable modules directory
│   ├── ecs/  
│   ├── iam/
│   ├── load_balancer/                               
│   ├── rds/ 
│   ├── security_groups/                   
│   └── vpc/                
├── .gitignore              # Git ignore file
└── README.md               # Project documentation (this file)

Outputs

After applying the configuration, the following outputs are available:

  • ALB DNS Name: The URL of the Application Load Balancer.
  • RDS Endpoint: The endpoint of the PostgreSQL database.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages