Coder Social home page Coder Social logo

johnny445 / app-docker-ecs-cfn Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chaturvedisulabh/app-docker-ecs-cfn

0.0 2.0 0.0 753 KB

IaC (AWS CFN Stack) AWS ECS with EC2 and Automated Deployment

License: MIT License

Dockerfile 66.14% Go 33.86%

app-docker-ecs-cfn's Introduction

NGX-APP-ECS-CFN

Introduction

This Task Deploys Nginx Docker container to ECS via CloudFormation and Builds CloudFormation Stack i.e. Deploys to AWS via one push CI/CD using tool called Drone CI. Following is the pictorial representation of the task HighLevelDesign

How do I make it work ?

  • Fork this repo
  • Create a free account on DroneCloud using your GitHub Account
  • Activate your forked repo (You will see an option to Activate, against all the repos Drone has been provided access to)
  • Repositories -> < YOUR_FORKED_REPO >->Settings
  • Add Secret as follows
    • AWS_ACCESS_KEY - < YOUR ACCESS KEY >
    • AWS_SECRET_KEY - < YOUR SECRET KEY >
    • Here, AWS_ACCESS_KEY and AWS_SECRET_KEY are the secret names, make sure the names are as is, if not find these names in .drone.yml file in the root repo and replace it with whatever you would prefer.
  • That's it, The one push Pipeline will do all the heavy lifting i.e. Deploy to AWS and everything will be up and running

NOTE: The Stack uses my Hosted Zone "iamsulabh.com", and it creates a CNAME Record mapped to ELB DNS NAME. So, my app is available at, http://ecs-app.iamsulabh.com. However, this will not work for you, so, you can just test as http://<YOUR_ELB_DNS_NAME (You can get ELB DNS NAME from EC2 Service -> Load Balancers).

Below Image, depicts Nginx accesssible from ELB on Port 80. nginx-elb-80

ARTIFACTS

  • CLOUD FORMATION Tempate - templates/infrastructure.json
  • CI/CD Pipeline - .drone.yml

Why I did, What I did ?

  • ECS fits better for the task and in AWS Ecosystem
  • CloudFormation nicely takes care of its recsources and since, I wasn't actually doing anything outside of AWS. So, I didn't worry about vendor lock-in else would have used Terraform
  • I found using nginx as better then, Writing Dockerfile for just a simple web app.
  • Could have created ECR, but for simplicity sake, I chose to stick with Docker public repository
  • Route53, Public ELB and Private EC2 with ECS running Containers ensures system is locked down and Attack surface is minimal

What could be done better ?

  • Ideally, KUBERNETES - create k8 cluster on kubernetes using Kops (I prefer, you may feel free to use the one you may want to). Deploy to Kubernetes cluster using CI/CD pipeline. Expose your pod using LoadBalancer service which is accessed from Route53/DNS Recordset in your hosted zone.
  • Why ? Because, No vendor lock-in, More than just Container Orchestration.

Add-Ons or call it extras (out-of-scope - Free)

  • go-simple-webserver is a minimalist webserver (app) written in go
  • Dockerfile - Dockerize the app and create the minimal size image of our app.
  • Next -> push this to Docker and update ./templates/infrastructure.json to use your image instead of nginx

app-docker-ecs-cfn's People

Contributors

chaturvedisulabh avatar

Watchers

 avatar  avatar

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.