How to Deploy a Docker App to AWS using Elastic Container Service (ECS)

    21
    20



    In this step by step tutorial, I show you how to deploy a Flask based Docker app to AWS. We start by building a local docker image and uploading it to Elastic Container Registry. We create an ECS Cluster, and configure a task to run our docker image. Finally, we launch a Task into the cluster and expose the app to the internet via VPC.

    00:10 Example Overview
    02:15 Application Walkthrough
    04:34 Creating a ECR Repository
    05:16 Uploading your Image to ECR
    06:28 Creating an ECS Cluster
    09:10 Creating a ECS Task Definition
    11:35 Running a Task on your Cluster
    13:03 Testing our app

    Want the docker file used in this video? Check out https://docker-curriculum.com/ Tutorial (about a third down the page). https://docker-curriculum.com/
    How to install the AWS CLI – https://youtu.be/jCHOsMPbcV0
    Source Code + Policy Template – https://gist.github.com/awssimplified/da49577fa48128e1da992dd6ec21085c

    šŸŽ‰SUPPORT BE A BETTER DEVšŸŽ‰
    Become a Patron: https://www.patreon.com/beabetterdev

    šŸ“š MY RECOMMENDED READING LIST FOR SOFTWARE DEVELOPERSšŸ“š
    Clean Code – https://amzn.to/37T7xdP
    Clean Architecture – https://amzn.to/3sCEGCe
    Head First Design Patterns – https://amzn.to/37WXAMy
    Domain Driver Design – https://amzn.to/3aWSW2W
    Code Complete – https://amzn.to/3ksQDrB
    The Pragmatic Programmer – https://amzn.to/3uH4kaQ
    Algorithms – https://amzn.to/3syvyP5
    Working Effectively with Legacy Code – https://amzn.to/3kvMza7
    Refactoring – https://amzn.to/3r6FQ8U

    šŸŽ™ MY RECORDING EQUIPMENT šŸŽ™
    Shure SM58 Microphone – https://amzn.to/3r5Hrf9
    Behringer UM2 Audio Interface – https://amzn.to/2MuEllM
    XLR Cable – https://amzn.to/3uGyZFx
    Acoustic Sound Absorbing Foam Panels – https://amzn.to/3ktIrY6
    Desk Microphone Mount – https://amzn.to/3qXMVIO
    Logitech C920s Webcam – https://amzn.to/303zGu9
    Fujilm XS10 Camera – https://amzn.to/3uGa30E
    Fujifilm XF 35mm F2 Lens – https://amzn.to/3rentPe
    Neewer 2 Piece Studio Lights – https://amzn.to/3uyoa8p

    šŸ’» MY DESKTOP EQUIPMENT šŸ’»
    Dell 34 inch Ultrawide Monitor – https://amzn.to/2NJwph6
    Autonomous ErgoChair 2 – https://bit.ly/2YzomEm
    Autonomous SmartDesk 2 Standing Desk – https://bit.ly/2YzomEm
    MX Master 3 Productivity Mouse – https://amzn.to/3aYwKVZ
    Das Keyboard Prime 13 MX Brown Mechanical- https://amzn.to/3uH6VBF
    Veikk A15 Drawing Tablet – https://amzn.to/3uBRWsN

    šŸ“š References:
    Getting started with AWS: https://youtu.be/lTyqzyk86f8

    ☁Topics covered include:
    Docker
    Flask App
    Elastic Container Registry
    Elastic Container Service

    šŸŒŽ Find me here:
    Twitter – https://twitter.com/BeABetterDevv
    Instagram – https://www.instagram.com/beabetterdevv/
    Patreon – Donations help fund additional content – https://www.patreon.com/beabetterdev

    #SoftwareEngineer
    #SoftwareDeveloper
    #ElasticContainerService
    #AWS

    source

    Previous articleMenjalankan Aplikasi Container di AWS dengan Amazon EKS | Tedy Tirtawidjaja | AWS Indonesia
    Next articleWhat is AWS Elastic Load Balancer (ELB) | AWS ELB Tutorial | Intellipaat

    20 COMMENTS

    1. For anyone getting this error: CannotStartContainerError: Error response from daemon: OCI runtime create failed: container_linux.go:370: starting container process caused: process_linux.go:338: getting the final child's pid from pipe caused: read init-p: connection reset by peer: unkno

      The cause is there's not enough memory assigned for your Task. If you followed along to the video, in task definition, change memory from 1 to 512 and CPU to 512 as well. Hope it helps

    2. Man! I wanna hug you! I suffered for about a month through bullshitery guides from amazon on how to do it! But you explained it so simply! Now I will need to make a pipeline with autodeploy. I hope you'll have videos on that topic. THANK YOU once again for such clear explanation.

    3. Hello, it's very strange I have done exactly the same and i have this error:

      CannotStartContainerError: Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: container init was OOM-killed (memory limit too low?): unknown

    4. Great tutorial, I have a question. I have a similar set-up and wonder if there is any way to handle clients loosing connection each time you make a deployement? E.g every time I deploy the users that were authenticated and signed in to the site gets kicked out since the container with redis gets cleared