/ecs-101-demo

A small demo application for an ECS 101 talk I'm giving @ AWSMeetupGroup

Primary LanguageHCLApache License 2.0Apache-2.0

ecs-101-demo

This is a small demo application for an ECS 101 talk that I gave @ AWSMeetupGroup. Here is the recorded video of the talk.

Repo Contents

  1. The Demo Application code resides in app/ and was originally copied from awesome-compose, specifically the React, Express, Mongo example. It has been slightly adapted for this example.
  2. The Infrastructure as Code for this example has been written in Terraform and resides in terraform/.
  3. The Task Definitions for the 3 services have been pulled down and shared in task_definitions/.

Deploying to AWS yourself

Prequisites

  1. Terraform v0.12.25
  2. Docker + Compose
  3. An AWS Account + AWS IAM Credentials

Instructions

Execute the following commands and tasks to spin up this ECS project in your own AWS account:

  1. cd ./terraform
  2. Update root.auto.tfvars with your own values
  3. terraform init
  4. terraform plan -out=run.plan
    1. Check out this commands plan output to make sure it fits what you want to deploy
  5. terraform apply run.plan
  6. Repeat the previous two steps until you don't have any apply errors (Terraform typically ain't perfect 😅)
  7. Copy down the two ECR endpoints that Terraform outputs
    1. export FRONTEND_ECR_URL=$(terraform output frontend_repo_url)
    2. export BACKEND_ECR_URL=$(terraform output backend_repo_url)
  8. Build and push the Frontend image:
    1. cd ../app/frontend
    2. docker build -tag $FRONTEND_ECR_URL:latest .
    3. docker push $FRONTEND_ECR_URL
  9. Build and push the Backend image:
    1. cd ../app/backend
    2. docker build -tag $BACKEND_ECR_URL:latest .
    3. docker push $BACKEND_ECR_URL
  10. Sign into the AWS console and check out the app running in ECS!
  11. Your app should also be running @ ecs101.${var.domain}