Skip to content

An open source template for deploying containerized workloads on AWS ECS with NGINX as the reverse proxy using terraform

License

Notifications You must be signed in to change notification settings

janudabethmin/ecs-with-nginx-proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terraform Template for ECS with NGINX

This is the only open source template for deploying containerized workloads on AWS ECS with NGINX as the reverse proxy, using Terraform. Feel free to use, modify, and share!

Screenshot from 2025-06-30 15-14-38

This repository provides an example of using Terraform to deploy an NGINX service on AWS ECS (Elastic Container Service). It includes reusable modules and a sample configuration for quick setup and experimentation.

Features

  • Modular Design: Easily reusable ECS module for running NGINX or other containerized services.
  • Sample Usage: Example configuration and variables for rapid deployment.
  • Custom NGINX Config: Override default NGINX settings with your own nginx.conf.

Getting Started

  1. Clone the repository
    git clone <this-repo-url>
    cd ecs-tf/example
  2. Initialize Terraform
    terraform init
  3. Review and update variables
    • Edit terraform.tfvars to set your AWS region, VPC, subnets, and other required parameters.
  4. Apply the configuration
    terraform apply

Requirements

  • Terraform >= 1.0.0
  • AWS account credentials configured (via environment variables or AWS CLI)

Customization

  • Modify nginx.conf in the example/ directory to change NGINX behavior.
  • The module in modules/ecs-nginx/ can be adapted for other container images or services.

Example terraform.tfvars

Below is a sample terraform.tfvars file with demo data. Replace the values with your actual AWS resource IDs and preferences:

vpc_id             = "vpc-12345678"
public_subnet_ids  = ["subnet-11111111", "subnet-22222222"] 
private_subnet_ids = ["subnet-33333333", "subnet-44444444"] 
aws_region         = "us-east-1"
name        = "demo-ecs-nginx"
tags = {
  "Name"        = "demo-ecs-nginx"
  "Environment" = "dev"
  "Project"     = "ecs-demo"
}

Cleaning Up

To destroy the created resources:

terraform destroy

License

MIT License. See LICENSE for details.


Last updated: 2025-06-24

About

An open source template for deploying containerized workloads on AWS ECS with NGINX as the reverse proxy using terraform

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •