{"id":1281,"date":"2018-08-20T18:56:36","date_gmt":"2018-08-20T18:56:36","guid":{"rendered":"https:\/\/www.codeastar.com\/?p=1281"},"modified":"2018-08-20T18:56:36","modified_gmt":"2018-08-20T18:56:36","slug":"tutorial-deploy-flask-docker-amazon-ecs","status":"publish","type":"post","link":"https:\/\/www.codeastar.com\/tutorial-deploy-flask-docker-amazon-ecs\/","title":{"rendered":"Amazon Tutorial: Deploy a Flask Docker image in ECS"},"content":{"rendered":"

We have learnt how to build a\u00a0weather forecast Flask app<\/a>. We have learnt how to deploy the Flask app to a Raspberry Pi\u00a0using Docker<\/a>. But we mostly focus on deploying our app in a local machine or a private network. In order to step up our game, we are going to deploy the app globally with AWS (Amazon Web Services) cloud platform. So we can showcase our work to people around the world.<\/p>\n

EC2 or ECS?<\/h3>\n

Speaking of AWS cloud platform, you may hear the term of “Amazon EC2” a lot. EC2 (Elastic Compute Cloud) is the core product of Amazon cloud platform, which provides an instance for you to do anything. You can setup a Nginx webserver or a MongoDB on EC2 instance. While ECS (Elastic Container Service) is a Docker service, which you can deploy different Docker images there. Since we are going to deploy a Flask app image, ECS is the place we are going to set our feet on.<\/p>\n

Although we are using ECS, we still need an instance from EC2 to host the Docker container. Sounds complicated? Maybe, but we have a better solution. As Amazon launches the AWS Fargate<\/a> which combines ECS and EC2 services. Once we deploy an image on Fargate, it will create its own instance, then we can sit back and enjoy launching our docker image, without dealing with any EC2 instance. But before we start to “sit back”, please make sure we have processed following steps:<\/p>\n

Prerequisite<\/h3>\n
    \n
  1. An AWS account (you can apply a free tier account at AWS homepage<\/a>)<\/li>\n
  2. AWS CLI<\/a> (AWS Command Line Interface)<\/li>\n
  3. An user account with proper rights to run container operations (details on the following\u00a0paragraph)<\/li>\n
  4. The Docker<\/a> tool (the whale)<\/li>\n
  5. Our weather forest Flask app, EZW! (you can get the whole source from here<\/a>. Yeah, we have moved to GitLab<\/a> from GitHub)<\/li>\n<\/ol>\n

    Step 1, 2, 4 and 5 are straight forward. Let’s talk about step 3. First of all, we need to create an user group and an user at IAM<\/a>\u00a0(Identity and Access Management). In the user group creation, two group policies, “AmazonEC2ContainerServiceRole” and “AmazonEC2ContainerRegistryFullAccess” must be included in the user group.<\/p>\n

    \"Amazon<\/p>\n

    After that, we can create an user, please note that we should select “Programmatic access” for this user. Then put the user in the user group we have just created.<\/p>\n

    \"\"<\/p>\n

    Dock our image<\/h3>\n

    Once the account setting work is done, we go to work on our docker image.\u00a0 After getting our EZW Flask app source, run following command to build the docker image:<\/p>\n

    $docker build -t ezw .<\/pre>\n

    We then run our docker image to make sure everything is okay.<\/p>\n

    $docker run -d --name ezcon -p 81:5000 -e DARK_SKY_KEY=[YOUR DARK SKY API KEY] ezw<\/pre>\n

    Please note that we have set 5000 as docker listening port in Dockerfile, so we input 5000 from above command. And port 81 is used here as port 80 is occupied by another web server in my machine :]] . Open a web browser and type “http:\/\/127.0.0.1:81” (or the ip address of your docker machine), you should see following screen:<\/p>\n

    \"\"<\/p>\n

    That means our docker image is fine and it works on our own machine. Okay, our next mission is doing the same thing again, but this time, we do it in Amazon cloud platform.<\/p>\n

    Dock in Amazon<\/h3>\n

    First, we go to AWS management console<\/a>, and click “Elastic Container Service” (ECS). We can see the Amazon Elastic C<\/span>ontainer Registry (<\/span>ECR) there, click it and press “Create repository”.<\/p>\n

    \"\"<\/p>\n

    It will ask you about the repository name, let’s name it “ezw” then. The repository “name” is now created, but not the content. Following screen will show up to instruct us what to do next.<\/p>\n

    \"\"This is a list of commands for pushing our docker image to the Amazon <\/span>ECR. Let’s go through it line by line.<\/span><\/p>\n

    $(aws ecr get-login --no-include-email --region us-east-2)<\/pre>\n

    Do you remember the user account we have created earlier? Yes, that is the account we use for logging into Amazon ECR. The “–region” is depended on the AWS region you are using.\u00a0<\/span><\/p>\n

    docker build -t ezw .<\/pre>\n

    Build the image, yeah, we did it before.<\/p>\n

    docker tag ezw:latest 4__________6.dkr.ecr.us-east-2.amazonaws.com\/ezw:latest<\/pre>\n

    Tag our docker image with your own AWS id (4__________6 in my case).<\/p>\n

    docker push 4_________6.dkr.ecr.us-east-2.amazonaws.com\/ezw:latest<\/pre>\n

    Just push tagged image to the ECR!
    \nAfter that, our image is stored in the ECR. Remember to copy the “Repository URI”, we will use it in our next step.<\/p>\n

    \"\"<\/p>\n

     <\/p>\n

    Launch with Fargate<\/h3>\n

    We have all our materials ready, now it is time to launch our EZW Flask app globally. We go to the ECS interface again, this time, we click “Clusters” and “Get Started”.<\/p>\n

    \"\"<\/p>\n

    Select “custom” container and press “Configure”<\/p>\n

    \"\"<\/p>\n

    We are going to let Fargate know which docker repository to use. On the “Image” field, let’s copy the “Repository URI” from our previous step to there. (if you forgot the URI, don’t worry, just go to “Amazon ECR” > “Repositories” to find out, it is on the same page as ECS)<\/p>\n

    We set a hard memory limit to 128 MiB, as our weather Flask app is just a tiny web app.<\/p>\n

    Port mappings is 5000 again as we have already defined it in our Dockerfile.<\/p>\n

    \"\"<\/p>\n

    Since we store our DARK SKY API key in environment variable. We have to set it on the ECS container setting as well. From the “Advanced container configuration”, create a new environment variable, “DARK_SKY_KEY” then enter your API value there.<\/p>\n

    \"\"<\/p>\n

    After that we can use just use the default setting and keep clicking “Next” till Amazon launch our service. We will see a similar screen when the service is ready to launch:\u00a0\u00a0\"\"<\/p>\n

    Okay, it is the time we try our EZW Flask App online.<\/p>\n

    Try the EZW Flask App Globally<\/h3>\n

    In order to do it, we need to know the public ip first. Let’s go to “Cluster” > “ezw”\u00a0 (or other cluster name you use for the Flask app) > “Tasks”. Since we have only one task in our EZW cluster, we can click the only task there to see the details. From the “Network” section, we will find the public ip there.<\/p>\n

    \"\"<\/p>\n

     <\/p>\n

    Open a browser, copy and paste the public ip there. And don’t forget to add the port number at the end. Here we go:<\/p>\n

    \"\"<\/p>\n

    We did it! We have just deployed our first ever web app on AWS with docker. There are still many things we need to learn and tune in the AWS. Like the maintenance should be cheaper, if we use Amazon EC2 instance instead of Fargate. As we have other pricing options for EC2, like On-Demand and Spot. But Fargate provides us a fast and clean deployment environment, it is good for having a demonstration to your business partners. It can also provide a showcase to your potential employers or audiences on what\u00a0you are capable of, Python, Flask, Docker, ECS and many others.<\/p>\n

     <\/p>\n

    What have we learnt in this post?<\/h3>\n
      \n
    1. The way to push docker image to Amazon\u00a0ECR<\/li>\n
    2. Usage of Amazon\u00a0ECS<\/li>\n
    3. Usage of Fargate<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"

      We have learnt how to build a\u00a0weather forecast Flask app. We have learnt how to deploy the Flask app to a Raspberry Pi\u00a0using Docker. But we mostly focus on deploying our app in a local machine or a private network. In order to step up our game, we are going to deploy the app globally […]<\/p>\n","protected":false},"author":1,"featured_media":1333,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"site-sidebar-layout":"default","site-content-layout":"default","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_newsletter_tier_id":0,"jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[2],"tags":[94,97,95,68,99,100,96,71,98,60,8,32],"jetpack_publicize_connections":[],"yoast_head":"\nAmazon Tutorial: Deploy a Flask Docker image in ECS ⋆ Code A Star<\/title>\n<meta name=\"description\" content=\"We are going to deploy a Python Flask app globally with AWS (Amazon Web Services) Fargate platform. So we can showcase our work to people around the world.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.codeastar.com\/tutorial-deploy-flask-docker-amazon-ecs\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Amazon Tutorial: Deploy a Flask Docker image in ECS ⋆ Code A Star\" \/>\n<meta property=\"og:description\" content=\"We are going to deploy a Python Flask app globally with AWS (Amazon Web Services) Fargate platform. So we can showcase our work to people around the world.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.codeastar.com\/tutorial-deploy-flask-docker-amazon-ecs\/\" \/>\n<meta property=\"og:site_name\" content=\"Code A Star\" \/>\n<meta property=\"article:publisher\" content=\"codeastar\" \/>\n<meta property=\"article:author\" content=\"codeastar\" \/>\n<meta property=\"article:published_time\" content=\"2018-08-20T18:56:36+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/i0.wp.com\/www.codeastar.com\/wp-content\/uploads\/2018\/08\/fargate.png?fit=1052%2C470&ssl=1\" \/>\n\t<meta property=\"og:image:width\" content=\"1052\" \/>\n\t<meta property=\"og:image:height\" content=\"470\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Raven Hon\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@codeastar\" \/>\n<meta name=\"twitter:site\" content=\"@codeastar\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Raven Hon\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.codeastar.com\/tutorial-deploy-flask-docker-amazon-ecs\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.codeastar.com\/tutorial-deploy-flask-docker-amazon-ecs\/\"},\"author\":{\"name\":\"Raven Hon\",\"@id\":\"https:\/\/www.codeastar.com\/#\/schema\/person\/832d202eb92a3d430097e88c6d0550bd\"},\"headline\":\"Amazon Tutorial: Deploy a Flask Docker image in ECS\",\"datePublished\":\"2018-08-20T18:56:36+00:00\",\"dateModified\":\"2018-08-20T18:56:36+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.codeastar.com\/tutorial-deploy-flask-docker-amazon-ecs\/\"},\"wordCount\":1136,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.codeastar.com\/#\/schema\/person\/832d202eb92a3d430097e88c6d0550bd\"},\"keywords\":[\"Amazon\",\"AWS\",\"cloud\",\"Docker\",\"EC2\",\"ECR\",\"ECS\",\"EZW\",\"Fargate\",\"flask\",\"Python\",\"weather forecast\"],\"articleSection\":[\"We code therefore we are\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.codeastar.com\/tutorial-deploy-flask-docker-amazon-ecs\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.codeastar.com\/tutorial-deploy-flask-docker-amazon-ecs\/\",\"url\":\"https:\/\/www.codeastar.com\/tutorial-deploy-flask-docker-amazon-ecs\/\",\"name\":\"Amazon Tutorial: Deploy a Flask Docker image in ECS ⋆ Code A Star\",\"isPartOf\":{\"@id\":\"https:\/\/www.codeastar.com\/#website\"},\"datePublished\":\"2018-08-20T18:56:36+00:00\",\"dateModified\":\"2018-08-20T18:56:36+00:00\",\"description\":\"We are going to deploy a Python Flask app globally with AWS (Amazon Web Services) Fargate platform. So we can showcase our work to people around the world.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.codeastar.com\/tutorial-deploy-flask-docker-amazon-ecs\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.codeastar.com\/tutorial-deploy-flask-docker-amazon-ecs\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.codeastar.com\/tutorial-deploy-flask-docker-amazon-ecs\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.codeastar.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Amazon Tutorial: Deploy a Flask Docker image in ECS\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.codeastar.com\/#website\",\"url\":\"https:\/\/www.codeastar.com\/\",\"name\":\"Code A Star\",\"description\":\"We don't wish upon a star, we code a star\",\"publisher\":{\"@id\":\"https:\/\/www.codeastar.com\/#\/schema\/person\/832d202eb92a3d430097e88c6d0550bd\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.codeastar.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.codeastar.com\/#\/schema\/person\/832d202eb92a3d430097e88c6d0550bd\",\"name\":\"Raven Hon\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.codeastar.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/i0.wp.com\/www.codeastar.com\/wp-content\/uploads\/2018\/08\/logo70.png?fit=70%2C70&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/www.codeastar.com\/wp-content\/uploads\/2018\/08\/logo70.png?fit=70%2C70&ssl=1\",\"width\":70,\"height\":70,\"caption\":\"Raven Hon\"},\"logo\":{\"@id\":\"https:\/\/www.codeastar.com\/#\/schema\/person\/image\/\"},\"description\":\"Raven Hon is\u00a0a 20 years+ veteran in information technology industry who has worked on various projects from console, web, game, banking and mobile applications in different sized companies.\",\"sameAs\":[\"https:\/\/www.codeastar.com\",\"codeastar\",\"https:\/\/twitter.com\/codeastar\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Amazon Tutorial: Deploy a Flask Docker image in ECS ⋆ Code A Star","description":"We are going to deploy a Python Flask app globally with AWS (Amazon Web Services) Fargate platform. So we can showcase our work to people around the world.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.codeastar.com\/tutorial-deploy-flask-docker-amazon-ecs\/","og_locale":"en_US","og_type":"article","og_title":"Amazon Tutorial: Deploy a Flask Docker image in ECS ⋆ Code A Star","og_description":"We are going to deploy a Python Flask app globally with AWS (Amazon Web Services) Fargate platform. So we can showcase our work to people around the world.","og_url":"https:\/\/www.codeastar.com\/tutorial-deploy-flask-docker-amazon-ecs\/","og_site_name":"Code A Star","article_publisher":"codeastar","article_author":"codeastar","article_published_time":"2018-08-20T18:56:36+00:00","og_image":[{"width":1052,"height":470,"url":"https:\/\/i0.wp.com\/www.codeastar.com\/wp-content\/uploads\/2018\/08\/fargate.png?fit=1052%2C470&ssl=1","type":"image\/png"}],"author":"Raven Hon","twitter_card":"summary_large_image","twitter_creator":"@codeastar","twitter_site":"@codeastar","twitter_misc":{"Written by":"Raven Hon","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.codeastar.com\/tutorial-deploy-flask-docker-amazon-ecs\/#article","isPartOf":{"@id":"https:\/\/www.codeastar.com\/tutorial-deploy-flask-docker-amazon-ecs\/"},"author":{"name":"Raven Hon","@id":"https:\/\/www.codeastar.com\/#\/schema\/person\/832d202eb92a3d430097e88c6d0550bd"},"headline":"Amazon Tutorial: Deploy a Flask Docker image in ECS","datePublished":"2018-08-20T18:56:36+00:00","dateModified":"2018-08-20T18:56:36+00:00","mainEntityOfPage":{"@id":"https:\/\/www.codeastar.com\/tutorial-deploy-flask-docker-amazon-ecs\/"},"wordCount":1136,"commentCount":0,"publisher":{"@id":"https:\/\/www.codeastar.com\/#\/schema\/person\/832d202eb92a3d430097e88c6d0550bd"},"keywords":["Amazon","AWS","cloud","Docker","EC2","ECR","ECS","EZW","Fargate","flask","Python","weather forecast"],"articleSection":["We code therefore we are"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.codeastar.com\/tutorial-deploy-flask-docker-amazon-ecs\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.codeastar.com\/tutorial-deploy-flask-docker-amazon-ecs\/","url":"https:\/\/www.codeastar.com\/tutorial-deploy-flask-docker-amazon-ecs\/","name":"Amazon Tutorial: Deploy a Flask Docker image in ECS ⋆ Code A Star","isPartOf":{"@id":"https:\/\/www.codeastar.com\/#website"},"datePublished":"2018-08-20T18:56:36+00:00","dateModified":"2018-08-20T18:56:36+00:00","description":"We are going to deploy a Python Flask app globally with AWS (Amazon Web Services) Fargate platform. So we can showcase our work to people around the world.","breadcrumb":{"@id":"https:\/\/www.codeastar.com\/tutorial-deploy-flask-docker-amazon-ecs\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.codeastar.com\/tutorial-deploy-flask-docker-amazon-ecs\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.codeastar.com\/tutorial-deploy-flask-docker-amazon-ecs\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.codeastar.com\/"},{"@type":"ListItem","position":2,"name":"Amazon Tutorial: Deploy a Flask Docker image in ECS"}]},{"@type":"WebSite","@id":"https:\/\/www.codeastar.com\/#website","url":"https:\/\/www.codeastar.com\/","name":"Code A Star","description":"We don't wish upon a star, we code a star","publisher":{"@id":"https:\/\/www.codeastar.com\/#\/schema\/person\/832d202eb92a3d430097e88c6d0550bd"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.codeastar.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.codeastar.com\/#\/schema\/person\/832d202eb92a3d430097e88c6d0550bd","name":"Raven Hon","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codeastar.com\/#\/schema\/person\/image\/","url":"https:\/\/i0.wp.com\/www.codeastar.com\/wp-content\/uploads\/2018\/08\/logo70.png?fit=70%2C70&ssl=1","contentUrl":"https:\/\/i0.wp.com\/www.codeastar.com\/wp-content\/uploads\/2018\/08\/logo70.png?fit=70%2C70&ssl=1","width":70,"height":70,"caption":"Raven Hon"},"logo":{"@id":"https:\/\/www.codeastar.com\/#\/schema\/person\/image\/"},"description":"Raven Hon is\u00a0a 20 years+ veteran in information technology industry who has worked on various projects from console, web, game, banking and mobile applications in different sized companies.","sameAs":["https:\/\/www.codeastar.com","codeastar","https:\/\/twitter.com\/codeastar"]}]}},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.codeastar.com\/wp-content\/uploads\/2018\/08\/fargate.png?fit=1052%2C470&ssl=1","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8PcRO-kF","jetpack-related-posts":[{"id":1393,"url":"https:\/\/www.codeastar.com\/deep-learning-amazon-web-services-aws\/","url_meta":{"origin":1281,"position":0},"title":"AWS Tutorial: Deep Learning on Amazon Web Services","author":"Raven Hon","date":"October 24, 2018","format":false,"excerpt":"So far, we have entered several Kaggle's machine learning competitions. Most of the time, we use Kaggle's free kernel to solve the puzzles. From the Deal Probability Prediction challenge, we reached the limit of Kaggle's kernel --- the 17 GB RAM limit, while we were training our model. When we\u2026","rel":"","context":"In "We code therefore we are"","block_context":{"text":"We code therefore we are","link":"https:\/\/www.codeastar.com\/category\/we-code-therefore-we-are\/"},"img":{"alt_text":"Happy Machine Learning on AWS","src":"https:\/\/i0.wp.com\/www.codeastar.com\/wp-content\/uploads\/2018\/10\/happy_learning-e1540353891851.png?fit=592%2C670&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.codeastar.com\/wp-content\/uploads\/2018\/10\/happy_learning-e1540353891851.png?fit=592%2C670&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.codeastar.com\/wp-content\/uploads\/2018\/10\/happy_learning-e1540353891851.png?fit=592%2C670&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":1835,"url":"https:\/\/www.codeastar.com\/elastic-beanstalk-with-react-frontend-and-flask-backend-part-3\/","url_meta":{"origin":1281,"position":1},"title":"Elastic Beanstalk with React Frontend and Flask Backend \u2013 Part 3","author":"Raven Hon","date":"March 25, 2019","format":false,"excerpt":"We have our Flask backend at the back to handle magic (weather forecast logic) and we have our React frontend dealing with user interfaces. So, what are we missing here? Every great team needs a leader to bring teammates working together. Thus we need a service to align both backend\u2026","rel":"","context":"In "We code therefore we are"","block_context":{"text":"We code therefore we are","link":"https:\/\/www.codeastar.com\/category\/we-code-therefore-we-are\/"},"img":{"alt_text":"AWS Integration","src":"https:\/\/i0.wp.com\/www.codeastar.com\/wp-content\/uploads\/2019\/03\/wq_hayley.png?fit=1000%2C500&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.codeastar.com\/wp-content\/uploads\/2019\/03\/wq_hayley.png?fit=1000%2C500&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.codeastar.com\/wp-content\/uploads\/2019\/03\/wq_hayley.png?fit=1000%2C500&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.codeastar.com\/wp-content\/uploads\/2019\/03\/wq_hayley.png?fit=1000%2C500&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":968,"url":"https:\/\/www.codeastar.com\/deploy-flask-app-docker-raspberry-pi\/","url_meta":{"origin":1281,"position":2},"title":"Tutorial: Deploy a Flask app with Docker on Raspberry Pi","author":"Raven Hon","date":"April 14, 2018","format":false,"excerpt":"We have just\u00a0installed Docker on our Raspberry Pi, now it is time to bring into action. Do you remember the EZW, Easy Weather Forecast Flask app? Yes, we are going to deploy this EZW flask app. Of course, we do it in the Docker way! Prerequisites Docker installed on a\u2026","rel":"","context":"In "Have a pie, Raspberry Pi(e)"","block_context":{"text":"Have a pie, Raspberry Pi(e)","link":"https:\/\/www.codeastar.com\/category\/have-a-raspberry-pie\/"},"img":{"alt_text":"Deploy Flask app on Raspberry Pi using Docker","src":"https:\/\/i0.wp.com\/www.codeastar.com\/wp-content\/uploads\/2018\/04\/flask_doc.png?fit=1032%2C456&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.codeastar.com\/wp-content\/uploads\/2018\/04\/flask_doc.png?fit=1032%2C456&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.codeastar.com\/wp-content\/uploads\/2018\/04\/flask_doc.png?fit=1032%2C456&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.codeastar.com\/wp-content\/uploads\/2018\/04\/flask_doc.png?fit=1032%2C456&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":930,"url":"https:\/\/www.codeastar.com\/install-docker-raspberry-pi\/","url_meta":{"origin":1281,"position":3},"title":"How to install Docker on Raspberry Pi","author":"Raven Hon","date":"April 3, 2018","format":false,"excerpt":"In this article, we will talk about Docker and Raspberry Pi.\u00a0Docker is a platform you may probably hear it often recently. It is hot because it helps people simplify the DevOps process. It lets developers build light-weight applications. Then they can ship and run their applications \"anywhere\" (we will discuss\u2026","rel":"","context":"In "Have a pie, Raspberry Pi(e)"","block_context":{"text":"Have a pie, Raspberry Pi(e)","link":"https:\/\/www.codeastar.com\/category\/have-a-raspberry-pie\/"},"img":{"alt_text":"Docker and Raspberry Pi","src":"https:\/\/i0.wp.com\/www.codeastar.com\/wp-content\/uploads\/2018\/04\/raspberry.png?fit=1000%2C542&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.codeastar.com\/wp-content\/uploads\/2018\/04\/raspberry.png?fit=1000%2C542&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.codeastar.com\/wp-content\/uploads\/2018\/04\/raspberry.png?fit=1000%2C542&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.codeastar.com\/wp-content\/uploads\/2018\/04\/raspberry.png?fit=1000%2C542&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":1740,"url":"https:\/\/www.codeastar.com\/flask-backend-react-frontend-weather-1\/","url_meta":{"origin":1281,"position":4},"title":"Flask Backend and React Frontend for Weather Forecast – Part 1","author":"Raven Hon","date":"February 25, 2019","format":false,"excerpt":"We built a weather forecast web app with Flask in past. That was an old fashioned way which we handled all frontend and backend stuff under Flask framework. The best practice for web applications nowadays is separating frontend and backend into 2 modules. So we can utilize both modules to\u2026","rel":"","context":"In "We code therefore we are"","block_context":{"text":"We code therefore we are","link":"https:\/\/www.codeastar.com\/category\/we-code-therefore-we-are\/"},"img":{"alt_text":"Flask backend","src":"https:\/\/i0.wp.com\/www.codeastar.com\/wp-content\/uploads\/2019\/02\/wq_milktea.png?fit=1000%2C500&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.codeastar.com\/wp-content\/uploads\/2019\/02\/wq_milktea.png?fit=1000%2C500&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.codeastar.com\/wp-content\/uploads\/2019\/02\/wq_milktea.png?fit=1000%2C500&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.codeastar.com\/wp-content\/uploads\/2019\/02\/wq_milktea.png?fit=1000%2C500&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":854,"url":"https:\/\/www.codeastar.com\/flask-easy-web-app-python\/","url_meta":{"origin":1281,"position":5},"title":"Easy Weather Forecast Flask Web App with Python","author":"Raven Hon","date":"March 10, 2018","format":false,"excerpt":"We have tried to code an Easy Weather Forecast Tool with Python. Yes, it is fast and easy, but it is just not that convenient to run anything on a command prompt. It is so.... 80s. It would be better if we can make a single-page Flask web app. Then\u2026","rel":"","context":"In "We code therefore we are"","block_context":{"text":"We code therefore we are","link":"https:\/\/www.codeastar.com\/category\/we-code-therefore-we-are\/"},"img":{"alt_text":"EZ Weather Forecast Web App in Flask","src":"https:\/\/i0.wp.com\/www.codeastar.com\/wp-content\/uploads\/2018\/03\/ezw_wep_app.png?fit=1030%2C460&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.codeastar.com\/wp-content\/uploads\/2018\/03\/ezw_wep_app.png?fit=1030%2C460&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.codeastar.com\/wp-content\/uploads\/2018\/03\/ezw_wep_app.png?fit=1030%2C460&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.codeastar.com\/wp-content\/uploads\/2018\/03\/ezw_wep_app.png?fit=1030%2C460&ssl=1&resize=700%2C400 2x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.codeastar.com\/wp-json\/wp\/v2\/posts\/1281"}],"collection":[{"href":"https:\/\/www.codeastar.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codeastar.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codeastar.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codeastar.com\/wp-json\/wp\/v2\/comments?post=1281"}],"version-history":[{"count":30,"href":"https:\/\/www.codeastar.com\/wp-json\/wp\/v2\/posts\/1281\/revisions"}],"predecessor-version":[{"id":1334,"href":"https:\/\/www.codeastar.com\/wp-json\/wp\/v2\/posts\/1281\/revisions\/1334"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.codeastar.com\/wp-json\/wp\/v2\/media\/1333"}],"wp:attachment":[{"href":"https:\/\/www.codeastar.com\/wp-json\/wp\/v2\/media?parent=1281"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codeastar.com\/wp-json\/wp\/v2\/categories?post=1281"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codeastar.com\/wp-json\/wp\/v2\/tags?post=1281"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}