{"id":1802,"date":"2021-09-19T20:46:54","date_gmt":"2021-09-19T10:46:54","guid":{"rendered":"https:\/\/ntsblog.homedev.com.au\/?p=1802"},"modified":"2023-10-26T21:07:42","modified_gmt":"2023-10-26T10:07:42","slug":"aws-ecs-tips-and-tricks","status":"publish","type":"post","link":"https:\/\/ntsblog.homedev.com.au\/index.php\/2021\/09\/19\/aws-ecs-tips-and-tricks\/","title":{"rendered":"AWS ECS Tips and Tricks"},"content":{"rendered":"<div id=\"ntsbl-3616875816\" class=\"ntsbl-before-content ntsbl-entity-placement\"><script async src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js?client=ca-pub-6288941070289539\" crossorigin=\"anonymous\"><\/script><ins class=\"adsbygoogle\" style=\"display:inline-block;width:728px;height:90px;\" \ndata-ad-client=\"ca-pub-6288941070289539\" \ndata-ad-slot=\"9356781486\"><\/ins> \n<script> \n(adsbygoogle = window.adsbygoogle || []).push({}); \n<\/script>\n<\/div>\n<h2 class=\"wp-block-heading\">Overview<\/h2>\n\n\n\n<p>I have recently started playing with AWS Elastic Container Service and there are a few neat things I have learnt that I wanted to let everyone else know about&#8230; read on..<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">How to stop a service &#8211; reboot loop<\/h3>\n\n\n\n<p>So you have deployed a bad version of your website and the load balancer health check is failing, so you end up in the following loop;<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Load balancer finds a problem with your task and kills it.<\/li>\n\n\n\n<li>The task stops.<\/li>\n\n\n\n<li>The service has a minimum task level of 1<\/li>\n\n\n\n<li>The ECS container starts a new task.<\/li>\n\n\n\n<li>The task is bad; goto step 1. <\/li>\n<\/ol>\n\n\n\n<p>So how do you get out of this loop?<\/p>\n\n\n\n<p>Do the following;<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Open your cluster<\/li>\n\n\n\n<li>Click on your service <\/li>\n\n\n\n<li>Click Update<\/li>\n\n\n\n<li>Set &#8220;Number of tasks&#8221; to 0<\/li>\n\n\n\n<li>Click &#8220;Skip to review&#8221;<\/li>\n\n\n\n<li>Click &#8220;Update Service&#8221;<\/li>\n<\/ol>\n\n\n\n<p>The service is now set to have a minimum task level of Zero, so now it will stop and NOT restart until you do the reverse and set it back to a number &gt; 0.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">How to rollback<\/h3>\n\n\n\n<p>So again you have deployed a task with a bug in it, and you quickly want to rollback to a previous version.<\/p>\n\n\n\n<p>ECS makes this super easy, do the following<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Open your cluster<\/li>\n\n\n\n<li>Click on your service <\/li>\n\n\n\n<li>Click Update <\/li>\n\n\n\n<li>In the &#8220;Revision&#8221; drop down choose the previous revision<\/li>\n\n\n\n<li>Click &#8220;Skip to review&#8221;<\/li>\n\n\n\n<li>Click &#8220;Update Service&#8221;<\/li>\n<\/ol>\n\n\n\n<p>This will cause the current revision to be drained and a new previous task will be launched.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Overview I have recently started playing with AWS Elastic Container Service and there are a few neat things I have learnt that I wanted to [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[32,48],"tags":[38,40],"class_list":["post-1802","post","type-post","status-publish","format-standard","hentry","category-aws","category-aws-ecs","tag-aws","tag-ecs"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ntsblog.homedev.com.au\/index.php\/wp-json\/wp\/v2\/posts\/1802","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ntsblog.homedev.com.au\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ntsblog.homedev.com.au\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ntsblog.homedev.com.au\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ntsblog.homedev.com.au\/index.php\/wp-json\/wp\/v2\/comments?post=1802"}],"version-history":[{"count":0,"href":"https:\/\/ntsblog.homedev.com.au\/index.php\/wp-json\/wp\/v2\/posts\/1802\/revisions"}],"wp:attachment":[{"href":"https:\/\/ntsblog.homedev.com.au\/index.php\/wp-json\/wp\/v2\/media?parent=1802"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ntsblog.homedev.com.au\/index.php\/wp-json\/wp\/v2\/categories?post=1802"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ntsblog.homedev.com.au\/index.php\/wp-json\/wp\/v2\/tags?post=1802"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}