Giter VIP home page Giter VIP logo

aws-ecs-typescript's Introduction

AWS ECS Fargate - TypeScript App

Correlating Video Tutorial

Prerequisites

  • AWS account with programatic access
  • AWS CLI must be installed
  • Domain name in Route 53 (talentize.com is my example)

Creates an AWS ECS Fargate Infrastructure

API Infastructure

Running this App locally

npm i
npm run dev
Then open http://localhost in your browser.

What you'll need to deploy to AWS:

A VPC and two subnets in the same AWS Region.

The code in this repository creates the infrastructure for an API service using AWS ECS Fargate and initially uses the default NGINX Image. Once successfully running, the sub-domain and SSL cert are attached to the ALB. You may then create an Image for this application locally, push it to AWS ECR and update the AWS ECS Fargate service to use your Image.

ecs-1.yml creates the AWS ECS Fargate infastructure for the API service.
ecs-2.yml updates the infrastructure to use HTTPS and the sub-domain.
Further instructions demonstrate pushing this application to AWS ECR and deploying to AWS.

Have your VPC ID handy along with two subnet ID's and run the below snippet replacing the four variables:

  • YOUR_VPC_ID
  • YOUR_SUBNET_1_ID
  • YOUR_SUBNET_2_ID
  • YOUR_DOMAIN_NAME.com

STEP 1

aws cloudformation create-stack --stack-name aws-ecs-typescript-api --template-body file://./ecs-1.yml --capabilities CAPABILITY_NAMED_IAM --parameters ParameterKey=VPCID,ParameterValue=YOUR_VPC_ID ParameterKey=Subnet1ID,ParameterValue=YOUR_SUBNET_1_ID ParameterKey=Subnet2ID,ParameterValue=YOUR_SUBNET_2_ID ParameterKey=DomainName,ParameterValue=YOUR_DOMAIN_NAME.com

After the stack has been succesfully created, run the below snippent replacing the same VPC ID's and subnets as above:

STEP 2

aws cloudformation update-stack --stack-name aws-ecs-typescript-api --template-body file://./ecs-2.yml --capabilities CAPABILITY_NAMED_IAM --parameters ParameterKey=Subnet1ID,ParameterValue=YOUR_SUBNET_1_ID ParameterKey=Subnet2ID,ParameterValue=YOUR_SUBNET_2_ID ParameterKey=VPCID,ParameterValue=YOUR_VPC_ID ParameterKey=DomainName,ParameterValue=YOUR_DOMAIN_NAME.com

Create an Image of this App and push to AWS ECR

Use your Account Number and Region and run the below snippet replacing instances of the variables:

  • YOUR_AWS_ACCCOUNT_NUMBER
  • YOUR_AWS_REGION
docker build -t aws-ecs-typescript-api .  

docker tag aws-ecs-typescript-api:latest YOUR_AWS_ACCCOUNT_NUMBER.dkr.ecr.YOUR_AWS_REGION.amazonaws.com/aws-ecs-typescript-api:latest  

aws ecr get-login-password --region YOUR_AWS_REGION | docker login --username AWS --password-stdin YOUR_AWS_ACCOUNT_NUMBER.dkr.ecr.YOUR_AWS_REGION.amazonaws.com  

docker push YOUR_AWS_ACCOUNT_NUMBER.dkr.ecr.YOUR_AWS_REGION.amazonaws.com/aws-ecs-typescript-api:latest

IMPORTANT

Replace the reference to Image: in ecs-2.yml
YOU MUST replace YOUR_AWS_ACCOUNT_NUMBER and YOUR_AWS_REGION to use your Image:
API Infastructure
with: API Infastructure

Save ecs-2.yml and re-run the script from STEP 2.

aws-ecs-typescript's People

Contributors

aaronwht avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

aws-ecs-typescript's Issues

ecs-2.yml file does not work correctly!

After I deploy ecs-1.yml file everything works as in your video. But after ecs-2.yml I cannot get not even NGINX page after first deployment (it say error 503) and after docker file installation I cannot get page of this node.js application you wrote. I guess that there is a problem with communication between load balancer and containers (and I tried to troubleshoot this a bit, but no luck). Could you please review your code and suggets what is wrong? Also I noticed a lot of differences between files in your video lecture and these files here on Github.

Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.