Skip to content

Latest commit

Β 

History

History
56 lines (38 loc) Β· 2.8 KB

File metadata and controls

56 lines (38 loc) Β· 2.8 KB

Terraform and Shell Scripts for ECS Environment Setup

This repository contains Terraform files and shell scripts to create a new Amazon ECS (Elastic Container Service) environment within a new VPC (Virtual Private Cloud). These scripts automate the provisioning of AWS infrastructure for deploying containerized applications efficiently.

πŸš€ Steps to Set Up the ECS Environment

Follow the steps below to successfully create and deploy your ECS environment.

Step 1: Install and Configure AWS CLI

Before running the setup, ensure that the AWS CLI is installed and configured on your local machine.

  • Install AWS CLI: Follow the official AWS documentation to install the CLI:
    πŸ‘‰ AWS CLI Installation Guide

  • Provide Full Access to AWS IAM Role: provide the full access to IAM Role

  • Configure AWS Credentials: Once installed, configure your AWS credentials by following this guide:
    πŸ‘‰ AWS CLI Authentication and Configuration

Step 2: Run the Shell Script to Create the Environment

Execute the shell script to initiate the ECS setup:

/bin/bash run.sh <github-repo-name>

πŸ“Œ What this script does:

  • Runs a Python script in the backend to automate resource creation.
  • Sets up AWS VPC, Subnet, Internet Gateway, ECR Repository, ECS Cluster, and ALB.
  • Upon successful execution, the script returns the Application Load Balancer (ALB) URL, which is required to access the deployed application.

Step 3: Create Your Own Repository from the Python App Boilerplate

To deploy your application, create a new repository based on the Python-app boilerplate.

Step 4: Push Code Changes to Trigger GitHub Actions

Make any new commit to the main branch of your repository. This will automatically trigger a GitHub Action that:

  • Builds the Docker image of your application.
  • Pushes the image to Amazon ECR (Elastic Container Registry).
  • Deploys the application to Amazon ECS.

Step 5: Access Your Deployed Application

Once the deployment is successful, you can access your application using the ALB URL obtained in Step 2.

πŸ”— Application URL: http://<ALB-DNS-Name>


🎯 Summary

βœ… Automated infrastructure provisioning using Terraform and shell scripts
βœ… Secure and scalable ECS deployment in a new VPC
βœ… Seamless GitHub Actions integration for CI/CD
βœ… Easy application access via ALB URL

This setup ensures a smooth and automated deployment process for your Python-based containerized applications on AWS ECS. πŸš€

For any issues or improvements, feel free to open an issue or contribute to this repository! 😊