{"id":2446,"date":"2024-01-17T00:08:58","date_gmt":"2024-01-17T00:08:58","guid":{"rendered":"https:\/\/www.maghilda.com\/staging\/9669\/?p=2446"},"modified":"2024-01-17T21:50:39","modified_gmt":"2024-01-17T21:50:39","slug":"deploy-docker-containers-on-ecs-using-fargate-and-ecs-cli","status":"publish","type":"post","link":"https:\/\/www.maghilda.com\/staging\/9669\/deploy-docker-containers-on-ecs-using-fargate-and-ecs-cli\/","title":{"rendered":"HOWTO: Deploy Docker Containers on Amazon ECS using Fargate with Amazon ECS-CLI"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\" style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0\">In this tutorial, we will deploy docker containers on Amazon ECS using AWS Fargate. We will be using ECS-CLI to build the stack step by step. Amazon ECS Command Line Interface (CLI) is a command line tool for Amazon Elastic Container Service (Amazon ECS) that provides high-level commands to simplify creating, updating, and monitoring clusters and tasks from a local development environment.&nbsp;In the future, I will build the same stack using CloudFormation.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0\">There are two parts to this tutorial<\/p>\n\n\n\n<ol class=\"wp-block-list\" style=\"margin-top:var(--wp--preset--spacing--40);margin-right:0;margin-bottom:var(--wp--preset--spacing--40);margin-left:0;padding-top:0;padding-right:var(--wp--preset--spacing--50);padding-bottom:0;padding-left:var(--wp--preset--spacing--50)\">\n<li>We will build and run a simple Python web application with Docker Compose. The application uses the Flask framework and maintains a hit counter in Redis. This tutorial is available on the Docker website <a href=\"https:\/\/docs.docker.com\/compose\/gettingstarted\/\">here<\/a> so I will not cover the details.<\/li>\n\n\n\n<li>Then we will deploy the image to ECS using ECS-CLI and FARGATE <\/li>\n<\/ol>\n\n\n\n<h5 class=\"wp-block-heading\">Services Used:<\/h5>\n\n\n\n<ul class=\"wp-block-list\" style=\"padding-right:var(--wp--preset--spacing--50);padding-left:var(--wp--preset--spacing--50)\">\n<li>AWS CLI<\/li>\n\n\n\n<li>ECS CLI<\/li>\n\n\n\n<li>Amazon CloudWatch<\/li>\n\n\n\n<li>Amazon Elastic Container Service (ECS)<\/li>\n\n\n\n<li>AWS Fargate<\/li>\n\n\n\n<li>Amazon Virtual Private Cloud (VPC)<\/li>\n\n\n\n<li>Docker<\/li>\n\n\n\n<li>Flask<\/li>\n\n\n\n<li>Redis<\/li>\n<\/ul>\n\n\n\n<h5 class=\"wp-block-heading\">Prerequisites<\/h5>\n\n\n\n<ul class=\"wp-block-list\" style=\"padding-right:var(--wp--preset--spacing--50);padding-left:var(--wp--preset--spacing--50)\">\n<li>IAM Identity Center user with appropriate permissions&nbsp;<\/li>\n\n\n\n<li>AWS CLI is installed &#8211; see my previous post <a href=\"https:\/\/www.maghilda.com\/staging\/9669\/easy-steps-to-aws-with-aws-cli-sdk\/\">here<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/docs.docker.com\/desktop\/\">Docker Desktop<\/a> is installed<\/li>\n\n\n\n<li>ECS-CLI (not to be confused with AWS CLI) is installed and configured &#8211; follow the directions <a href=\"https:\/\/github.com\/aws\/amazon-ecs-cli\">here<\/a><\/li>\n<\/ul>\n\n\n\n<h5 class=\"wp-block-heading\">Steps<\/h5>\n\n\n\n<ol class=\"wp-block-list\" style=\"padding-right:var(--wp--preset--spacing--50);padding-left:var(--wp--preset--spacing--50)\">\n<li>Build your image using Dockerfile, run it locally and validate that it executes successfully (I am using the sample application from <a href=\"https:\/\/docs.docker.com\/compose\/gettingstarted\/\">Docker<\/a> for this tutorial)<\/li>\n\n\n\n<li>Rebuild the image with changes to app.py and deploy the image to ECR<\/li>\n\n\n\n<li>Create a cluster and security group<\/li>\n\n\n\n<li>Create ecs-params.yml and docker-compose.yml files and configure the cluster&nbsp;<\/li>\n\n\n\n<li>Compose a service&nbsp;<\/li>\n\n\n\n<li>Validate your implementation<\/li>\n\n\n\n<li>Clean up resources<\/li>\n<\/ol>\n\n\n\n<h5 class=\"wp-block-heading\">STEP 1 : Docker Compose<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">I have very small variation from the Docker tutorial, but listing all the files below with the changes highlighted. My folder name is testapp and that&#8217;s why you will notice the default naming convention of the containers and images with testapp.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"margin-top:0;margin-bottom:0\">app.py<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import time\nimport redis\nfrom flask import Flask\n\napp = Flask(__name__)\ncache = redis.Redis(host='redis', port=6379)\n<strong># change to localhost for deploying to ECS\n#cache = redis.Redis(host='localhost', port=6379)<\/strong>\n\ndef get_hit_count():\n    retries = 5\n    while True:\n        try:\n            return cache.incr('hits')\n        except redis.exceptions.ConnectionError as exc:\n            if retries == 0:\n                raise exc\n            retries -= 1\n            time.sleep(0.5)\n\n@app.route('\/')\ndef hello():\n    count = get_hit_count()\n    return 'Hello Maghilda! I have been seen {} times.\\n'.format(count)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"margin-top:0;margin-bottom:0\">Dockerfile<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>FROM python:3.11-alpine<\/strong>\nWORKDIR \/code\nENV FLASK_APP=app.py\nENV FLASK_RUN_HOST=0.0.0.0\nRUN apk add --no-cache gcc musl-dev linux-headers\nCOPY requirements.txt requirements.txt\n#install dependencies from  list\nRUN pip install -r requirements.txt\nEXPOSE 5000\nCOPY . .\nCMD &#91;\"flask\", \"run\"]<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"margin-top:0;margin-bottom:0\">compose.yml<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>services:\n  web:\n    build: .\n    ports:\n      - \"5000:5000\"\n<strong>    networks:\n      - demoapp<\/strong>\n  redis:\n    image: \"redis:alpine\"\n<strong>    networks:\n      - demoapp<\/strong>\n    volumes:\n    <strong>  - redisdata:\/data<\/strong>\n\n<strong>networks:\n    demoapp:\n\nvolumes:\n  redisdata:<\/strong><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"margin-top:0;margin-bottom:0\">Build and run your app with compose<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker compose up -d<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"margin-top:0;margin-bottom:0\">When the docker compose finishes successfully, you can either go http:\/\/127.0.0.1:5000 or use a curl command to validate.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>curl '127.0.0.1:5000'<\/strong>\n\nHello Maghilda! I have been seen 1 times.<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"margin-top:0;margin-bottom:0\">To check the env variable that you had defined in the Dockerfile<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>docker compose run web env<\/strong>\n\nPATH=\/usr\/local\/bin:\/usr\/local\/sbin:\/usr\/local\/bin:\/usr\/sbin:\/usr\/bin:\/sbin:\/bin\nHOSTNAME=b0d84f2608d6\nTERM=xterm\nLANG=C.UTF-8\nGPG_KEY=A035C8C19219BA821ECEA86B64E628F8D684696D\nPYTHON_VERSION=3.11.7\nPYTHON_PIP_VERSION=23.2.1\nPYTHON_SETUPTOOLS_VERSION=65.5.1\nPYTHON_GET_PIP_URL=https:\/\/github.com\/pypa\/get-pip\/raw\/4cfa4081d27285bda1220a62a5ebf5b4bd749cdb\/public\/get-pip.py\nPYTHON_GET_PIP_SHA256=9cc01665956d22b3bf057ae8287b035827bfd895da235bcea200ab3b811790b6\nFLASK_APP=app.py\nFLASK_RUN_HOST=0.0.0.0\nHOME=\/root<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\" style=\"font-size:0px\"><code><strong>docker ps<\/strong>\n\nCONTAINER ID   IMAGE          COMMAND                  CREATED         STATUS         PORTS                    NAMES\nc05b5b095fab   <strong>redis:alpine<\/strong>   \"docker-entrypoint.s\u2026\"   4 minutes ago   Up 4 minutes   6379\/tcp                 testapp-redis-1\n9e07c31729a6   <strong>testapp-web<\/strong>    \"flask run\"              4 minutes ago   Up 4 minutes   0.0.0.0:5000-&gt;5000\/tcp   testapp-web-1<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"margin-top:0;margin-bottom:0\">Login to the container<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker exec -it <strong>9e07c31729a6<\/strong> \/bin\/sh<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"margin-top:0;margin-bottom:0\">You will get the container terminal, run some commands in the container terminal. I ran the ls command which listed all the files. Once done, type exit.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>\/code # ls<\/strong>\n\nDockerfile                    app.py                       requirements.txt\n__pycache__                   compose.yaml     <\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"margin-top:0;margin-bottom:0\">Shut down the container and delete the image<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker compose down -v<\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">STEP 2: Rebuild the image with changes to app.py and deploy the image to ECR<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"margin-top:0;margin-bottom:0\">For the image to work in ECS, update the app.py. Change the redis connection from redis to localhost as follows:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#cache = redis.Redis(<strong>host='redis'<\/strong>, port=6379)\n# change to localhost for deploying to ECS\ncache = redis.Redis(<strong>host='localhost'<\/strong>, port=6379)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"margin-top:0;margin-bottom:0\">Then build the image again but without docker compose<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker build -t testapp .<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"margin-top:0;margin-bottom:0\">Tag the new image<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker tag testapp 123456789012.dkr.ecr.us-east-1.amazonaws.com\/dockerimages:<strong>mnewtag<\/strong><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"margin-top:0;margin-bottom:0\">Create a repository in ECR. I named it dockerimages<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>aws ecr create-repository --repository-name dockerimages --region us-east-1<\/strong>\n\n{\n    \"repository\": {\n        \"repositoryArn\": \"arn:aws:ecr:us-east-1:123456789012:repository\/dockerimages\",\n        \"registryId\": \"123456789012\",\n        \"repositoryName\": \"dockerimages\",\n        \"repositoryUri\": \"123456789012.dkr.ecr.us-east-1.amazonaws.com\/dockerimages\",\n        \"createdAt\": \"2024-01-16T13:53:20-05:00\",\n        \"imageTagMutability\": \"MUTABLE\",\n        \"imageScanningConfiguration\": {\n            \"scanOnPush\": false\n        },\n        \"encryptionConfiguration\": {\n            \"encryptionType\": \"AES256\"\n        }\n    }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"margin-top:0;margin-bottom:0\">Login to ECR from Docker<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 123456789012.dkr.ecr.us-east-1.amazonaws.com<\/strong>\n\nLogin Succeeded<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"margin-top:0;margin-bottom:0\">Push the newly created image from Docker to ECR<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>docker push 123456789012.dkr.ecr.us-east-1.amazonaws.com\/dockerimages:mnewtag<\/strong>\n\nThe push refers to repository &#91;123456789012.dkr.ecr.us-east-1.amazonaws.com\/dockerimages]\n5ad795cc690c: Pushed \na10eca000a2f: Pushed \nmnewtag: digest: sha256:02ec90be72edeb611f1222f548e5884ad8dfce204f693575cf5d9e0bf5d71296 size: 2412<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>aws ecr list-images --repository-name dockerimages\n{\n    \"imageIds\": &#91;\n        {\n            \"imageDigest\": \"sha256:02ec90be72edeb611f1222f548e5884ad8dfce204f693575cf5d9e0bf5d71296\",\n            \"imageTag\": \"mnewtag\"\n        }\n    ]\n}<\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">STEP 3: Create a cluster and a security group<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"margin-top:0;margin-bottom:0\">This will launch a cloudformation stack<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>ecs-cli up --cluster maghilda-cluster --launch-type FARGATE <\/strong>\n\nINFO&#91;0000] Created cluster                               cluster=maghilda-cluster region=us-east-1\nINFO&#91;0001] Waiting for your cluster resources to be created... \nINFO&#91;0001] Cloudformation stack status                   stackStatus=CREATE_IN_PROGRESS\nVPC created: vpc-02b89083fd596fab1\nSubnet created: subnet-0ad8279daf5983c83\nSubnet created: subnet-03060b21523ea37b5\nCluster creation succeeded.<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>aws ecs describe-clusters \\\n    --include ATTACHMENTS \\\n    --clusters maghilda-cluster<\/strong>\n\n{\n    \"clusters\": &#91;\n        {\n            \"clusterArn\": \"arn:aws:ecs:us-east-1:123456789012:cluster\/maghilda-cluster\",\n            \"clusterName\": \"maghilda-cluster\",\n            \"status\": \"ACTIVE\",\n            \"registeredContainerInstancesCount\": 0,\n            \"runningTasksCount\": 0,\n            \"pendingTasksCount\": 0,\n            \"activeServicesCount\": 0,\n            \"statistics\": &#91;],\n            \"tags\": &#91;],\n            \"settings\": &#91;],\n            \"capacityProviders\": &#91;],\n            \"defaultCapacityProviderStrategy\": &#91;],\n            \"attachments\": &#91;]\n        }\n    ],\n    \"failures\": &#91;]\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"margin-top:0;margin-bottom:0\">Create a security group<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>aws ec2 create-security-group --group-name \"maghilda-fargate-service-discovery-sg\" \\\n--description \"Maghilda Fargate Service Discovery security group\" \\\n--vpc-id \"vpc-02b89083fd596fab1\"<\/strong>\n\n{\n    \"GroupId\": \"sg-0ee81ee6e7c955957\"\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"margin-top:0;margin-bottom:0\">Create ingress rules to allow 5000 traffic<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>aws ec2 authorize-security-group-ingress \\\n--group-id \"sg-0ee81ee6e7c955957\" --protocol \\\ntcp --port 5000 --cidr 0.0.0.0\/0<\/strong>\n\n{\n    \"Return\": true,\n    \"SecurityGroupRules\": &#91;\n        {\n            \"SecurityGroupRuleId\": \"sgr-0fdd8b43e8f6c61f3\",\n            \"GroupId\": \"sg-0ee81ee6e7c955957\",\n            \"GroupOwnerId\": \"123456789012\",\n            \"IsEgress\": false,\n            \"IpProtocol\": \"tcp\",\n            \"FromPort\": 5000,\n            \"ToPort\": 5000,\n            \"CidrIpv4\": \"0.0.0.0\/0\"\n        }\n    ]\n}<\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">STEP 4: Create ecs-params.yml and docker-compose.yml files and configure the cluster&nbsp;<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"margin-top:0;margin-bottom:0\">ecs-params.yml<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>version: 1\ntask_definition:\n  task_execution_role: ecsTaskExecutionRole\n  ecs_network_mode: awsvpc\n  task_size:\n    mem_limit: 0.5GB\n    cpu_limit: 256\nrun_params:\n  network_configuration:\n    awsvpc_configuration:\n      subnets:\n        - \"subnet-0ad8279daf5983c83\"\n        - \"subnet-03060b21523ea37b5\"\n      security_groups:\n        - \"sg-0ee81ee6e7c955957\"\n      assign_public_ip: ENABLED<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"margin-top:0;margin-bottom:0\">docker-compose.yml. This is not the same as compose.yml file above<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>version: '3'\nservices:\n  web:\n    image: \"123456789012.dkr.ecr.us-east-1.amazonaws.com\/dockerimages:mnewtag\"\n    ports:\n      - \"5000:5000\"\n    logging:\n      driver: awslogs\n      options:\n        awslogs-group: \/ecs\/development\/testapp-logs\n        awslogs-region: us-east-1\n        awslogs-stream-prefix: maghilda\n  redis:\n    image: \"public.ecr.aws\/docker\/library\/redis:6.2-bookworm\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"margin-top:0;margin-bottom:0\">Configure the cluster with FARGATE as the launch type<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>ecs-cli configure --cluster maghilda-cluster --region us-east-1 --default-launch-type FARGATE --config-name ecs-fargate-svs-discovery-config<\/strong>\n\nINFO&#91;0000] Saved ECS CLI cluster configuration ecs-fargate-svs-discovery-config. <\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"margin-top:0;margin-bottom:0\">This is saved in the ecs config file<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>cat ~\/.ecs\/config<\/strong>\n\nversion: v1\ndefault: ecs-fargate-svs-discovery-config\nclusters:\n  ecs-fargate-svs-discovery-config:\n    cluster: maghilda-cluster\n    region: us-east-1\n    default_launch_type: FARGATE<\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">STEP 5: Compose a service&nbsp;<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"margin-top:0;margin-bottom:0\">This is where the magic happens. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>ecs-cli compose --project-name maghilda-testapp \\\nservice up --cluster-config ecs-fargate-svs-discovery-config \\\n--cluster maghilda-cluster  --create-log-groups<\/strong>\n\nINFO&#91;0000] Using ECS task definition                     TaskDefinition=\"maghilda-testapp:1\"\nINFO&#91;0000] Auto-enabling ECS Managed Tags               \nINFO&#91;0011] (service maghilda-testapp) has started 1 tasks: (task 61653f47e8de41dfa86927f79dd0c557).  timestamp=\"2024-01-16 15:52:37 +0000 UTC\"\nINFO&#91;0067] (service maghilda-testapp) has started 1 tasks: (task 87cb0a1384f348ec82da68ccc6ff3bc5).  timestamp=\"2024-01-16 15:53:35 +0000 UTC\"\nINFO&#91;0305] Created an ECS service                        service=maghilda-testapp taskDefinition=\u201cmaghilda-testapp:1\"\nINFO&#91;0036] Service status                                desiredCount=1 runningCount=1 serviceName=maghilda-testapp\nINFO&#91;0036] ECS Service has reached a stable state        desiredCount=1 runningCount=1 serviceName=maghilda-testapp<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"272\" src=\"https:\/\/www.maghilda.com\/staging\/9669\/wp-content\/uploads\/2024\/01\/Screen-Shot-2024-01-15-at-10.55.44-PM-1024x272.png\" alt=\"\" class=\"wp-image-2484\" srcset=\"https:\/\/www.maghilda.com\/staging\/9669\/wp-content\/uploads\/2024\/01\/Screen-Shot-2024-01-15-at-10.55.44-PM-1024x272.png 1024w, https:\/\/www.maghilda.com\/staging\/9669\/wp-content\/uploads\/2024\/01\/Screen-Shot-2024-01-15-at-10.55.44-PM-300x80.png 300w, https:\/\/www.maghilda.com\/staging\/9669\/wp-content\/uploads\/2024\/01\/Screen-Shot-2024-01-15-at-10.55.44-PM-768x204.png 768w, https:\/\/www.maghilda.com\/staging\/9669\/wp-content\/uploads\/2024\/01\/Screen-Shot-2024-01-15-at-10.55.44-PM.png 1333w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h5 class=\"wp-block-heading\">STEP 6: Validate your implementation<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>ecs-cli ps --cluster maghilda-cluster<\/strong>\n\nName                                                     State                  Ports                         TaskDefinition      Health\nmaghilda-cluster\/4be0c3641cb74194b1588510800f6577\/redis  RUNNING                                              maghilda-testapp:1  UNKNOWN\nmaghilda-cluster\/4be0c3641cb74194b1588510800f6577\/web    RUNNING                <strong>44.192.11.173:5000-&gt;5000\/tcp<\/strong>  maghilda-testapp:1  UNKNOWN<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"margin-top:0;margin-bottom:0\">Load the above url <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"676\" height=\"169\" src=\"https:\/\/www.maghilda.com\/staging\/9669\/wp-content\/uploads\/2024\/01\/Screen-Shot-2024-01-16-at-3.42.07-PM.png\" alt=\"\" class=\"wp-image-2483\" srcset=\"https:\/\/www.maghilda.com\/staging\/9669\/wp-content\/uploads\/2024\/01\/Screen-Shot-2024-01-16-at-3.42.07-PM.png 676w, https:\/\/www.maghilda.com\/staging\/9669\/wp-content\/uploads\/2024\/01\/Screen-Shot-2024-01-16-at-3.42.07-PM-300x75.png 300w\" sizes=\"(max-width: 676px) 100vw, 676px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"margin-top:0;margin-bottom:0\">Review the CloudWatch Logs via aws cli or the AWS management console<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"874\" height=\"302\" src=\"https:\/\/www.maghilda.com\/staging\/9669\/wp-content\/uploads\/2024\/01\/Screen-Shot-2024-01-16-at-4.03.33-PM.png\" alt=\"\" class=\"wp-image-2485\" srcset=\"https:\/\/www.maghilda.com\/staging\/9669\/wp-content\/uploads\/2024\/01\/Screen-Shot-2024-01-16-at-4.03.33-PM.png 874w, https:\/\/www.maghilda.com\/staging\/9669\/wp-content\/uploads\/2024\/01\/Screen-Shot-2024-01-16-at-4.03.33-PM-300x104.png 300w, https:\/\/www.maghilda.com\/staging\/9669\/wp-content\/uploads\/2024\/01\/Screen-Shot-2024-01-16-at-4.03.33-PM-768x265.png 768w\" sizes=\"(max-width: 874px) 100vw, 874px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"863\" height=\"263\" src=\"https:\/\/www.maghilda.com\/staging\/9669\/wp-content\/uploads\/2024\/01\/Screen-Shot-2024-01-16-at-4.03.52-PM.png\" alt=\"\" class=\"wp-image-2486\" srcset=\"https:\/\/www.maghilda.com\/staging\/9669\/wp-content\/uploads\/2024\/01\/Screen-Shot-2024-01-16-at-4.03.52-PM.png 863w, https:\/\/www.maghilda.com\/staging\/9669\/wp-content\/uploads\/2024\/01\/Screen-Shot-2024-01-16-at-4.03.52-PM-300x91.png 300w, https:\/\/www.maghilda.com\/staging\/9669\/wp-content\/uploads\/2024\/01\/Screen-Shot-2024-01-16-at-4.03.52-PM-768x234.png 768w\" sizes=\"(max-width: 863px) 100vw, 863px\" \/><\/figure>\n\n\n\n<h5 class=\"wp-block-heading\">STEP 7: Cleanup resources<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"margin-top:0;margin-bottom:0\">Delete the service<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>ecs-cli compose --project-name maghilda-testapp \\\nservice down --cluster-config ecs-fargate-svs-discovery-config \\\n--cluster maghilda-cluster<\/strong>\n\nINFO&#91;0000] Deleted ECS service                           service=maghilda-testapp\nINFO&#91;0000] Service status                                desiredCount=0 runningCount=1 serviceName=maghilda-testapp\nINFO&#91;0005] Service status                                desiredCount=0 runningCount=0 serviceName=maghilda-testapp\nINFO&#91;0005] ECS Service has reached a stable state        desiredCount=0 runningCount=0 serviceName=maghilda-testapp<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"margin-top:0;margin-bottom:0\">Delete the cluster. This can take a long time as CloudFormation tears down the stack.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>ecs-cli down --force --cluster-config ecs-fargate-svs-discovery-config \\\n--cluster maghilda-cluster<\/strong>\n\n####### this errored out as the cloudformation could not delete the vpc as it had dependencies. i had to delete the vpc manually\nINFO&#91;0000] Waiting for your cluster resources to be deleted... \nINFO&#91;0000] Cloudformation stack status                   stackStatus=DELETE_IN_PROGRESS\nINFO&#91;0031] Deleted cluster                               cluster=maghilda-cluster<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"margin-top:0;margin-bottom:0\">Delete the namespace<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>aws servicediscovery list-namespaces<\/strong>\n\n{\n    \"Namespaces\": &#91;\n        {\n            \"Id\": \"ns-fd2a72lp4cvtuvnf\",\n            \"Arn\": \"arn:aws:servicediscovery:us-east-1:123456789012:namespace\/ns-fd2a72lp4cvtuvnf\",\n            \"Name\": \"maghilda-cluster\",\n            \"Type\": \"HTTP\",\n            \"Properties\": {\n                \"DnsProperties\": {\n                    \"SOA\": {}\n                },\n                \"HttpProperties\": {\n                    \"HttpName\": \"maghilda-cluster\"\n                }\n            },\n            \"CreateDate\": \"2024-01-15T22:48:55.143000-05:00\"\n        }\n    ]\n}\n\n<strong>aws servicediscovery delete-namespace --id=\"ns-fd2a72lp4cvtuvnf\"<\/strong>\n\n{\n    \"OperationId\": \"ncfzqtijxhicuygj4ziuw53ggekmoqvt-6pl90bxl\"\n}\n\n<strong>aws servicediscovery list-namespaces<\/strong>\n{\n    \"Namespaces\": &#91;]\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"margin-top:0;margin-bottom:0\">Delete ECR repository<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>aws ecr delete-repository --repository-name dockerimages --region us-east-1 --force<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"margin-top:0;margin-bottom:0\">Delete CloudWatch Logs<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>aws logs delete-log-group --log-group-name \/ecs\/development\/testapp-logs<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This is the end of the tutorial. Hope you got something out of it.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">References:<\/h5>\n\n\n\n<ul class=\"wp-block-list\" style=\"padding-right:var(--wp--preset--spacing--50);padding-left:var(--wp--preset--spacing--50)\">\n<li><a href=\"https:\/\/docs.docker.com\/compose\/gettingstarted\/\">https:\/\/docs.docker.com\/compose\/gettingstarted\/<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/github.com\/docker\/awesome-compose\">https:\/\/github.com\/docker\/awesome-compose<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/github.com\/aws\/amazon-ecs-cli\">https:\/\/github.com\/aws\/amazon-ecs-cli<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/docs.aws.amazon.com\/AmazonECS\/latest\/developerguide\/ProgrammingGuide.html\">https:\/\/docs.aws.amazon.com\/AmazonECS\/latest\/developerguide\/ProgrammingGuide.html<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/github.com\/aws-containers\/demo-app-for-docker-compose\">https:\/\/github.com\/aws-containers\/demo-app-for-docker-compose<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/gallery.ecr.aws\/\">https:\/\/gallery.ecr.aws\/<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.bogotobogo.com\/DevOps\/Docker\/Docker-ECS-Service-Dicsovery-Redis-Flask.php\">https:\/\/www.bogotobogo.com\/DevOps\/Docker\/Docker-ECS-Service-Dicsovery-Redis-Flask.php<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/aws.amazon.com\/blogs\/containers\/automated-software-delivery-using-docker-compose-and-amazon-ecs\/\">https:\/\/aws.amazon.com\/blogs\/containers\/automated-software-delivery-using-docker-compose-and-amazon-ecs\/<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/github.com\/docker\/compose-cli\/blob\/main\/docs\/ecs-compose-examples.md\">https:\/\/github.com\/docker\/compose-cli\/blob\/main\/docs\/ecs-compose-examples.md<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/aws.amazon.com\/blogs\/containers\/deploy-applications-on-amazon-ecs-using-docker-compose\/\">https:\/\/aws.amazon.com\/blogs\/containers\/deploy-applications-on-amazon-ecs-using-docker-compose\/<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/aws.amazon.com\/getting-started\/hands-on\/deploy-docker-containers\/\">https:\/\/aws.amazon.com\/getting-started\/hands-on\/deploy-docker-containers\/<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/docs.aws.amazon.com\/AmazonECS\/latest\/userguide\/create-container-image.html\">https:\/\/docs.aws.amazon.com\/AmazonECS\/latest\/userguide\/create-container-image.html<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/docs.aws.amazon.com\/AmazonECS\/latest\/developerguide\/using_awslogs.html\">https:\/\/docs.aws.amazon.com\/AmazonECS\/latest\/developerguide\/using_awslogs.html<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/awscli.amazonaws.com\/v2\/documentation\/api\/latest\/reference\/ecs\/index.html\">https:\/\/awscli.amazonaws.com\/v2\/documentation\/api\/latest\/reference\/ecs\/index.html<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, we will deploy docker containers on Amazon ECS using AWS Fargate. We will be using ECS-CLI to build the stack step by step. Amazon ECS Command Line Interface (CLI) is a command line tool for Amazon Elastic Container Service (Amazon ECS) that provides high-level commands to simplify creating, updating, and monitoring clusters [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","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":"","ast-disable-related-posts":"","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":"set","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":""}},"footnotes":""},"categories":[12,62,55,60,58,61,59,63],"tags":[66,64,65,67],"class_list":["post-2446","post","type-post","status-publish","format-standard","hentry","category-aws-tutorial","category-aws-cli","category-cloudwatch","category-docker","category-ecs","category-ecs-cli","category-fargate","category-vpc","tag-docker","tag-ecs","tag-fargate","tag-vpc"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>HOWTO: Deploy Docker Containers on Amazon ECS using Fargate with Amazon ECS-CLI - maghilda<\/title>\n<meta name=\"description\" content=\"Deploy Docker Containers on Amazon ECS using Fargate and Amazon ECS-CLI\" \/>\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.maghilda.com\/staging\/9669\/deploy-docker-containers-on-ecs-using-fargate-and-ecs-cli\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"HOWTO: Deploy Docker Containers on Amazon ECS using Fargate with Amazon ECS-CLI - maghilda\" \/>\n<meta property=\"og:description\" content=\"Deploy Docker Containers on Amazon ECS using Fargate and Amazon ECS-CLI\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.maghilda.com\/staging\/9669\/deploy-docker-containers-on-ecs-using-fargate-and-ecs-cli\/\" \/>\n<meta property=\"og:site_name\" content=\"maghilda\" \/>\n<meta property=\"article:published_time\" content=\"2024-01-17T00:08:58+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-01-17T21:50:39+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.maghilda.com\/staging\/9669\/wp-content\/uploads\/2024\/01\/Screen-Shot-2024-01-15-at-10.55.44-PM-1024x272.png\" \/>\n<meta name=\"author\" content=\"vibs\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"vibs\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/deploy-docker-containers-on-ecs-using-fargate-and-ecs-cli\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/deploy-docker-containers-on-ecs-using-fargate-and-ecs-cli\\\/\"},\"author\":{\"name\":\"vibs\",\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/#\\\/schema\\\/person\\\/21009c5e4f1817ea18c81d5004bcec1e\"},\"headline\":\"HOWTO: Deploy Docker Containers on Amazon ECS using Fargate with Amazon ECS-CLI\",\"datePublished\":\"2024-01-17T00:08:58+00:00\",\"dateModified\":\"2024-01-17T21:50:39+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/deploy-docker-containers-on-ecs-using-fargate-and-ecs-cli\\\/\"},\"wordCount\":727,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/deploy-docker-containers-on-ecs-using-fargate-and-ecs-cli\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/wp-content\\\/uploads\\\/2024\\\/01\\\/Screen-Shot-2024-01-15-at-10.55.44-PM-1024x272.png\",\"keywords\":[\"Docker\",\"ECS\",\"Fargate\",\"VPC\"],\"articleSection\":[\"AWS Tutorial\",\"AWS-CLI\",\"CloudWatch\",\"Docker\",\"ECS\",\"ECS-CLI\",\"Fargate\",\"VPC\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/deploy-docker-containers-on-ecs-using-fargate-and-ecs-cli\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/deploy-docker-containers-on-ecs-using-fargate-and-ecs-cli\\\/\",\"url\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/deploy-docker-containers-on-ecs-using-fargate-and-ecs-cli\\\/\",\"name\":\"HOWTO: Deploy Docker Containers on Amazon ECS using Fargate with Amazon ECS-CLI - maghilda\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/deploy-docker-containers-on-ecs-using-fargate-and-ecs-cli\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/deploy-docker-containers-on-ecs-using-fargate-and-ecs-cli\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/wp-content\\\/uploads\\\/2024\\\/01\\\/Screen-Shot-2024-01-15-at-10.55.44-PM-1024x272.png\",\"datePublished\":\"2024-01-17T00:08:58+00:00\",\"dateModified\":\"2024-01-17T21:50:39+00:00\",\"description\":\"Deploy Docker Containers on Amazon ECS using Fargate and Amazon ECS-CLI\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/deploy-docker-containers-on-ecs-using-fargate-and-ecs-cli\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/deploy-docker-containers-on-ecs-using-fargate-and-ecs-cli\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/deploy-docker-containers-on-ecs-using-fargate-and-ecs-cli\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/wp-content\\\/uploads\\\/2024\\\/01\\\/Screen-Shot-2024-01-15-at-10.55.44-PM.png\",\"contentUrl\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/wp-content\\\/uploads\\\/2024\\\/01\\\/Screen-Shot-2024-01-15-at-10.55.44-PM.png\",\"width\":1333,\"height\":354},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/deploy-docker-containers-on-ecs-using-fargate-and-ecs-cli\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"HOWTO: Deploy Docker Containers on Amazon ECS using Fargate with Amazon ECS-CLI\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/#website\",\"url\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/\",\"name\":\"maghilda.com\",\"description\":\"Technology blog focused on cloud computing, emerging technologies, software development and security.\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/#organization\",\"name\":\"maghilda.com\",\"url\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/wp-content\\\/uploads\\\/2023\\\/12\\\/cropped-logo_red.png\",\"contentUrl\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/wp-content\\\/uploads\\\/2023\\\/12\\\/cropped-logo_red.png\",\"width\":512,\"height\":512,\"caption\":\"maghilda.com\"},\"image\":{\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/#\\\/schema\\\/person\\\/21009c5e4f1817ea18c81d5004bcec1e\",\"name\":\"vibs\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/28233c799bf0736fecb2854057b69e52d9bd97b467b55be3406890936003faee?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/28233c799bf0736fecb2854057b69e52d9bd97b467b55be3406890936003faee?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/28233c799bf0736fecb2854057b69e52d9bd97b467b55be3406890936003faee?s=96&d=mm&r=g\",\"caption\":\"vibs\"},\"sameAs\":[\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\"],\"url\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/author\\\/obliczte\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"HOWTO: Deploy Docker Containers on Amazon ECS using Fargate with Amazon ECS-CLI - maghilda","description":"Deploy Docker Containers on Amazon ECS using Fargate and Amazon ECS-CLI","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.maghilda.com\/staging\/9669\/deploy-docker-containers-on-ecs-using-fargate-and-ecs-cli\/","og_locale":"en_US","og_type":"article","og_title":"HOWTO: Deploy Docker Containers on Amazon ECS using Fargate with Amazon ECS-CLI - maghilda","og_description":"Deploy Docker Containers on Amazon ECS using Fargate and Amazon ECS-CLI","og_url":"https:\/\/www.maghilda.com\/staging\/9669\/deploy-docker-containers-on-ecs-using-fargate-and-ecs-cli\/","og_site_name":"maghilda","article_published_time":"2024-01-17T00:08:58+00:00","article_modified_time":"2024-01-17T21:50:39+00:00","og_image":[{"url":"https:\/\/www.maghilda.com\/staging\/9669\/wp-content\/uploads\/2024\/01\/Screen-Shot-2024-01-15-at-10.55.44-PM-1024x272.png","type":"","width":"","height":""}],"author":"vibs","twitter_card":"summary_large_image","twitter_misc":{"Written by":"vibs","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.maghilda.com\/staging\/9669\/deploy-docker-containers-on-ecs-using-fargate-and-ecs-cli\/#article","isPartOf":{"@id":"https:\/\/www.maghilda.com\/staging\/9669\/deploy-docker-containers-on-ecs-using-fargate-and-ecs-cli\/"},"author":{"name":"vibs","@id":"https:\/\/www.maghilda.com\/staging\/9669\/#\/schema\/person\/21009c5e4f1817ea18c81d5004bcec1e"},"headline":"HOWTO: Deploy Docker Containers on Amazon ECS using Fargate with Amazon ECS-CLI","datePublished":"2024-01-17T00:08:58+00:00","dateModified":"2024-01-17T21:50:39+00:00","mainEntityOfPage":{"@id":"https:\/\/www.maghilda.com\/staging\/9669\/deploy-docker-containers-on-ecs-using-fargate-and-ecs-cli\/"},"wordCount":727,"commentCount":0,"publisher":{"@id":"https:\/\/www.maghilda.com\/staging\/9669\/#organization"},"image":{"@id":"https:\/\/www.maghilda.com\/staging\/9669\/deploy-docker-containers-on-ecs-using-fargate-and-ecs-cli\/#primaryimage"},"thumbnailUrl":"https:\/\/www.maghilda.com\/staging\/9669\/wp-content\/uploads\/2024\/01\/Screen-Shot-2024-01-15-at-10.55.44-PM-1024x272.png","keywords":["Docker","ECS","Fargate","VPC"],"articleSection":["AWS Tutorial","AWS-CLI","CloudWatch","Docker","ECS","ECS-CLI","Fargate","VPC"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.maghilda.com\/staging\/9669\/deploy-docker-containers-on-ecs-using-fargate-and-ecs-cli\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.maghilda.com\/staging\/9669\/deploy-docker-containers-on-ecs-using-fargate-and-ecs-cli\/","url":"https:\/\/www.maghilda.com\/staging\/9669\/deploy-docker-containers-on-ecs-using-fargate-and-ecs-cli\/","name":"HOWTO: Deploy Docker Containers on Amazon ECS using Fargate with Amazon ECS-CLI - maghilda","isPartOf":{"@id":"https:\/\/www.maghilda.com\/staging\/9669\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.maghilda.com\/staging\/9669\/deploy-docker-containers-on-ecs-using-fargate-and-ecs-cli\/#primaryimage"},"image":{"@id":"https:\/\/www.maghilda.com\/staging\/9669\/deploy-docker-containers-on-ecs-using-fargate-and-ecs-cli\/#primaryimage"},"thumbnailUrl":"https:\/\/www.maghilda.com\/staging\/9669\/wp-content\/uploads\/2024\/01\/Screen-Shot-2024-01-15-at-10.55.44-PM-1024x272.png","datePublished":"2024-01-17T00:08:58+00:00","dateModified":"2024-01-17T21:50:39+00:00","description":"Deploy Docker Containers on Amazon ECS using Fargate and Amazon ECS-CLI","breadcrumb":{"@id":"https:\/\/www.maghilda.com\/staging\/9669\/deploy-docker-containers-on-ecs-using-fargate-and-ecs-cli\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.maghilda.com\/staging\/9669\/deploy-docker-containers-on-ecs-using-fargate-and-ecs-cli\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.maghilda.com\/staging\/9669\/deploy-docker-containers-on-ecs-using-fargate-and-ecs-cli\/#primaryimage","url":"https:\/\/www.maghilda.com\/staging\/9669\/wp-content\/uploads\/2024\/01\/Screen-Shot-2024-01-15-at-10.55.44-PM.png","contentUrl":"https:\/\/www.maghilda.com\/staging\/9669\/wp-content\/uploads\/2024\/01\/Screen-Shot-2024-01-15-at-10.55.44-PM.png","width":1333,"height":354},{"@type":"BreadcrumbList","@id":"https:\/\/www.maghilda.com\/staging\/9669\/deploy-docker-containers-on-ecs-using-fargate-and-ecs-cli\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.maghilda.com\/staging\/9669\/"},{"@type":"ListItem","position":2,"name":"HOWTO: Deploy Docker Containers on Amazon ECS using Fargate with Amazon ECS-CLI"}]},{"@type":"WebSite","@id":"https:\/\/www.maghilda.com\/staging\/9669\/#website","url":"https:\/\/www.maghilda.com\/staging\/9669\/","name":"maghilda.com","description":"Technology blog focused on cloud computing, emerging technologies, software development and security.","publisher":{"@id":"https:\/\/www.maghilda.com\/staging\/9669\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.maghilda.com\/staging\/9669\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.maghilda.com\/staging\/9669\/#organization","name":"maghilda.com","url":"https:\/\/www.maghilda.com\/staging\/9669\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.maghilda.com\/staging\/9669\/#\/schema\/logo\/image\/","url":"https:\/\/www.maghilda.com\/staging\/9669\/wp-content\/uploads\/2023\/12\/cropped-logo_red.png","contentUrl":"https:\/\/www.maghilda.com\/staging\/9669\/wp-content\/uploads\/2023\/12\/cropped-logo_red.png","width":512,"height":512,"caption":"maghilda.com"},"image":{"@id":"https:\/\/www.maghilda.com\/staging\/9669\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.maghilda.com\/staging\/9669\/#\/schema\/person\/21009c5e4f1817ea18c81d5004bcec1e","name":"vibs","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/28233c799bf0736fecb2854057b69e52d9bd97b467b55be3406890936003faee?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/28233c799bf0736fecb2854057b69e52d9bd97b467b55be3406890936003faee?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/28233c799bf0736fecb2854057b69e52d9bd97b467b55be3406890936003faee?s=96&d=mm&r=g","caption":"vibs"},"sameAs":["https:\/\/www.maghilda.com\/staging\/9669"],"url":"https:\/\/www.maghilda.com\/staging\/9669\/author\/obliczte\/"}]}},"_links":{"self":[{"href":"https:\/\/www.maghilda.com\/staging\/9669\/wp-json\/wp\/v2\/posts\/2446","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.maghilda.com\/staging\/9669\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.maghilda.com\/staging\/9669\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.maghilda.com\/staging\/9669\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.maghilda.com\/staging\/9669\/wp-json\/wp\/v2\/comments?post=2446"}],"version-history":[{"count":5,"href":"https:\/\/www.maghilda.com\/staging\/9669\/wp-json\/wp\/v2\/posts\/2446\/revisions"}],"predecessor-version":[{"id":2531,"href":"https:\/\/www.maghilda.com\/staging\/9669\/wp-json\/wp\/v2\/posts\/2446\/revisions\/2531"}],"wp:attachment":[{"href":"https:\/\/www.maghilda.com\/staging\/9669\/wp-json\/wp\/v2\/media?parent=2446"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.maghilda.com\/staging\/9669\/wp-json\/wp\/v2\/categories?post=2446"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.maghilda.com\/staging\/9669\/wp-json\/wp\/v2\/tags?post=2446"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}