{"id":14693,"date":"2021-05-14T10:20:15","date_gmt":"2021-05-14T08:20:15","guid":{"rendered":"https:\/\/www.codemotion.com\/magazine\/?p=14693"},"modified":"2022-01-05T20:02:48","modified_gmt":"2022-01-05T19:02:48","slug":"working-with-spot-instances-on-aws-fargate","status":"publish","type":"post","link":"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/working-with-spot-instances-on-aws-fargate\/","title":{"rendered":"Working with Spot Instances on AWS Fargate"},"content":{"rendered":"\n<p>AWS Fargate is a popular cloud service that lets you run containers in a serverless model\u2014without having to manage the underlying server infrastructure. <\/p>\n\n\n\n<p>In this article, you&#8217;ll see how to use Fargate with a twist: running Fargate on EC2 spot instances and getting substantial discounts, for workloads that are not sensitive to the occasional interruption.<\/p>\n\n\n\t\t\t\t<div class=\"wp-block-uagb-table-of-contents uagb-toc__align-left uagb-toc__columns-1  uagb-block-0f025242      \"\n\t\t\t\t\tdata-scroll= \"1\"\n\t\t\t\t\tdata-offset= \"30\"\n\t\t\t\t\tstyle=\"\"\n\t\t\t\t>\n\t\t\t\t<div class=\"uagb-toc__wrap\">\n\t\t\t\t\t\t<div class=\"uagb-toc__title\">\n\t\t\t\t\t\t\tTable Of Contents\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class=\"uagb-toc__list-wrap \">\n\t\t\t\t\t\t<ol class=\"uagb-toc__list\"><li class=\"uagb-toc__list\"><a href=\"#what-are-aws-spot-instances\" class=\"uagb-toc-link__trigger\">What are AWS Spot Instances?<\/a><li class=\"uagb-toc__list\"><a href=\"#how-aws-fargate-pricing-works\" class=\"uagb-toc-link__trigger\">How AWS Fargate Pricing Works<\/a><li class=\"uagb-toc__list\"><a href=\"#aws-fargate-spot\" class=\"uagb-toc-link__trigger\">AWS Fargate Spot<\/a><li class=\"uagb-toc__list\"><a href=\"#tutorial-launch-ecs-fargate-spot-task-using-aws-management-console\" class=\"uagb-toc-link__trigger\">Tutorial: Launch ECS Fargate Spot Task Using AWS Management Console<\/a><li class=\"uagb-toc__list\"><a href=\"#conclusion\" class=\"uagb-toc-link__trigger\">Conclusion<\/a><\/ol>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\n\n\n<h2 class=\"wp-block-heading\" id=\"h-what-are-aws-spot-instances\">What are AWS Spot Instances?<\/h2>\n\n\n\n<p>The AWS Spot Instance purchasing option lets you buy unused Amazon Elastic Compute Cloud (Amazon EC2) capacity at a discounted rate. You can acquire Spot Instances through a bidding process, in which you specify the maximum price per hour you are willing to pay per instance.&nbsp;<\/p>\n\n\n\n<p>When an instance becomes available at your target price, you get the instance for a discounted price. Once the price exceeds your bid or equals on-demand pricing, the instance is stopped. When the price decreases again, the <a href=\"https:\/\/www.codemotion.com\/magazine\/dev-hub\/backend-dev\/naturally-born-reactive-systems\/\" target=\"_blank\" rel=\"noopener\">system reactivates<\/a> the instance. This process repeats until you cancel your bid.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-how-aws-fargate-pricing-works\">How AWS Fargate Pricing Works<\/h2>\n\n\n\n<p>AWS Fargate, <a href=\"https:\/\/lumigo.io\/aws-serverless-ecosystem\/\" target=\"_blank\" aria-label=\" (opens in a new tab)\" rel=\"noreferrer noopener\" class=\"ek-link\">part of the AWS serverless ecosystem<\/a> which includes popular tools like AWS Lambda, lets you run containers on serverless infrastructure. You can use Fargate to provision your Amazon Elastic Container Service (Amazon ECS) and Amazon Elastic Kubernetes Service (Amazon EKS) without having to manage servers and infrastructure.&nbsp;<\/p>\n\n\n\n<p>Like other AWS services, <a href=\"https:\/\/spot.io\/blog\/aws-fargate-pricing-how-to-optimize-billing-and-save-costs\/\" target=\"_blank\" aria-label=\" (opens in a new tab)\" rel=\"noreferrer noopener\" class=\"ek-link\">Fargate provides an on-demand pricing option<\/a> that allows you to provision resources as needed. You do not need to pay any upfront fees. Instead, you pay for the virtual centralized processing unit (vCPU) and memory resources your containerized application consumes.<\/p>\n\n\n\n<p>Fargate bills you per second, starting at the minimum duration of one minute. The starting time begins when you start downloading the container image and ends at the termination time of the Amazon EKS Pod or the Amazon ECS Task. Additional fees apply for <a href=\"https:\/\/www.codemotion.com\/magazine\/dev-hub\/data-scientist\/cyber-data-ai\/\" target=\"_blank\" rel=\"noopener\">data<\/a> transfers and operations performed by other AWS services.<\/p>\n\n\n\n<p>[jwp-video n=&#8221;1&#8243;]<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-aws-fargate-spot\">AWS Fargate Spot<\/h2>\n\n\n\n<p>Fargate Spot is a new, built-in Fargate feature that lets you run interruption-tolerant EC2 Tasks at discounts of up to 70% off the market price. This feature works just like AWS Spot Instance\u2014you get a significant discount for using spare capacity.<\/p>\n\n\n\n<p>Whenever there is available capacity for Fargate Spot, you can launch tasks according to specified requests. The system notifies you two minutes before AWS needs this capacity back, and then tasks running on these instances are interrupted.&nbsp;<\/p>\n\n\n\n<p>When Fargate Spot capacity is no longer available, Fargate scales down tasks running on this capacity and maintains all regular tasks. To ensure continuity, prefer running mainly fault-tolerant and parallelizable workloads, such as genomic processing and image rendering, on Fargate Spot.&nbsp;<\/p>\n\n\n\n<p>To use Fargate Spot, you need to create a Service Autoscaling policy, in which you define the minimum amount of regular tasks you want running during all times and tasks allocated to Fargate Spot capacity. Once capacity is available, the Scheduler launches tasks according to your predefined requirements.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-tutorial-launch-ecs-fargate-spot-task-using-aws-management-console\">Tutorial: Launch ECS Fargate Spot Task Using AWS Management Console<\/h2>\n\n\n\n<p>Here is a quick walkthrough explaining how to launch an EC2 Fargate Spot Task via the AWS Console:<\/p>\n\n\n\n<p>1. Go to the <a href=\"https:\/\/console.aws.amazon.com\/ecs\/home\" target=\"_blank\" aria-label=\" (opens in a new tab)\" rel=\"noreferrer noopener\" class=\"ek-link\">Amazon ECS console<\/a> web page<\/p>\n\n\n\n<p>2. Go to the navigation menu and select a <strong>Region<\/strong><\/p>\n\n\n\n<p>3. Go to the navigation pane and choose the <strong>Clusters<\/strong> option<\/p>\n\n\n\n<p>4. In the <strong>Clusters<\/strong> page, choose the <strong>Create Cluster<\/strong> option<\/p>\n\n\n\n<p>5. Choose the block that creates a <strong>Networking only<\/strong> Cluster<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh6.googleusercontent.com\/O_LbiNfH0pYbz4un-EXRS_dvycKuOvPvFT4dPyhtiRHBTHjM9uyNS5g28IvuT79WQTp94uXWFxrm1xKlhtu7rIXtzmNISKP-XJM1uJi2xzmlA5aWIphoFDo7DlerYICrAJDDWnor\" alt=\"\"\/><\/figure>\n\n\n\n<p>The \u201cnetworking only\u201d cluster option lets you launch a cluster with a new Amazon Virtual Private Cloud (Amazon VPC), which will be used for your Fargate tasks.&nbsp;<\/p>\n\n\n\n<p>Once you set this up, your cluster will automatically be associated with <strong>FARGATE <\/strong>and <strong>FARGATE_SPOT<\/strong> capacity providers (see the image below).<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/eewNPlrsQ8ZfCFsU1owxFmA4rDw1s7HViRjjAVoI1DFqA4nmwwL32plI0KUVRmS34jo_KraHXxgpZhplOZlQxw7BuiqGN9YGOPq_ZN7MeRV01IBIE4NEGQD2oqp0kmiYLMBVu52q\" alt=\"\"\/><\/figure>\n\n\n\n<p>6. From the top right-hand side, choose <strong>Update Cluster<\/strong>. This option lets you define a capacity provider strategy.<\/p>\n\n\n\n<p>7. Create a <strong>Task Definition<\/strong>. You can choose some <a href=\"https:\/\/github.com\/aws-samples\/aws-containers-task-definitions\" target=\"_blank\" aria-label=\" (opens in a new tab)\" rel=\"noreferrer noopener\" class=\"ek-link\">Task definitions<\/a> from this repository. Here is how to set this up:<\/p>\n\n\n\n<ul class=\"is-style-default wp-block-list\"><li>Locate the <strong>Task Definition<\/strong> link in the left navigation panel.<\/li><li>Choose the <strong>Create a New Task Definition<\/strong> option.<\/li><li>Choose a <strong>Fargate <\/strong>launch type.&nbsp;<\/li><li>In the bottom of the page, locate the <strong>Configure via JSON<\/strong> button.<\/li><li>Delete the pre-populated JSON entry.<\/li><li>Add the sample Fargate WebApp task definition provided in the image below to the now empty JSON entry.&nbsp;<\/li><li>Click the <strong>Save<\/strong> button.&nbsp;<\/li><li>Click the <strong>Create<\/strong> button.<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh6.googleusercontent.com\/4osvlmLF3PPM3jqCXTr99NBWXN9FHpkfPe9K8O1PvldiN6teJHJKZJVpUh1a8kIbLye9Thn6BxMHZtC4INfo5cUvJqJKAg3z3g1rHW0bHVXhJ6YWNCdm9YjWc3Kw9OaOLVK37CJ1\" alt=\"\"\/><\/figure>\n\n\n\n<p>8. Run the Task definition. Here is the process you should follow:<\/p>\n\n\n\n<ul class=\"is-style-default wp-block-list\"><li>Select your newly created Task definition&nbsp;<\/li><li>Choose the <strong>Action<\/strong>, <strong>Run Task<\/strong> option&nbsp;<\/li><li>Define the amount of Tasks you want to run (the image below defines 10 tasks)&nbsp;<\/li><li>Configure the <a href=\"https:\/\/cloud.netapp.com\/blog\/aws-blg-aws-security-a-quick-start-guide\" target=\"_blank\" aria-label=\" (opens in a new tab)\" rel=\"noreferrer noopener\" class=\"ek-link\">VPC and security groups&nbsp;<\/a><\/li><li>Click the<strong> Run Task<\/strong> button<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh6.googleusercontent.com\/UrjYb8lVIIVefAlv7j5uesUKtpCv-YRwyUVWf5nDCATJUkj71jhSTqrZwmdaxCiB1SFbWasDNBCnSf6X8w8SS5divFGj43ZhKMn5alxopsi9e7cerACSCRGYChzYqjABOpp-i1fS\" alt=\"\"\/><\/figure>\n\n\n\n<p>The image above starts 10 tasks\u20148\/10 are launched on FARGATE_SPOT and 2\/10 are launched on FARGATE with a 4:1 ratio. To see the ratio, you can choose any Task, go to the <strong>Details<\/strong> tab, and locate the \u201c<strong>Capacity provider<\/strong>\u201d value for each task.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h2>\n\n\n\n<p>Amazon Fargate is a powerful innovation that allows many developers to run containers without having to manage the underlying infrastructure. The convergence between containers and serverless is making an impact many <a href=\"https:\/\/www.codemotion.com\/magazine\/dev-hub\/cloud-manager\/digital-developer-conference-cloud-native-security\/\" target=\"_blank\" rel=\"noopener\">cloud native development<\/a> projects.&nbsp;<\/p>\n\n\n\n<p>In this article, I showed how to use spare capacity on Amazon EC2 to obtain significant discounts on Amazon Fargate. I discussed spot pricing concepts on Amazon EC2 and Fargate, and provided a brief tutorial that shows how to create a Fargate EC2 Spot Task. I hope this will be of help as you start leveraging serverless infrastructure in your organization.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>AWS Fargate is a popular cloud service that lets you run containers in a serverless model\u2014without having to manage the underlying server infrastructure. In this article, you&#8217;ll see how to use Fargate with a twist: running Fargate on EC2 spot instances and getting substantial discounts, for workloads that are not sensitive to the occasional interruption.&#8230; <a class=\"more-link\" href=\"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/working-with-spot-instances-on-aws-fargate\/\">Read more<\/a><\/p>\n","protected":false},"author":100,"featured_media":14772,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_editorskit_title_hidden":false,"_editorskit_reading_time":4,"_editorskit_is_block_options_detached":false,"_editorskit_block_options_position":"{}","_uag_custom_page_level_css":"","_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[5244],"tags":[],"collections":[],"class_list":{"0":"post-14693","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-cloud","8":"entry"},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.9 (Yoast SEO v27.5) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Working with Spot Instances on AWS Fargate - Codemotion Magazine<\/title>\n<meta name=\"description\" content=\"In this article, you&#039;ll see how to use AWS Fargate on EC2 spot instances for workloads that are not sensitive to the occasional interruption.\" \/>\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.codemotion.com\/magazine\/devops\/cloud\/working-with-spot-instances-on-aws-fargate\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Working with Spot Instances on AWS Fargate\" \/>\n<meta property=\"og:description\" content=\"In this article, you&#039;ll see how to use AWS Fargate on EC2 spot instances for workloads that are not sensitive to the occasional interruption.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/working-with-spot-instances-on-aws-fargate\/\" \/>\n<meta property=\"og:site_name\" content=\"Codemotion Magazine\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/Codemotion.Italy\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-05-14T08:20:15+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-01-05T19:02:48+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2021\/05\/Working-with-Spot-Instances-on-AWS-Fargate.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Gilad David Maayan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@gilad_maayan\" \/>\n<meta name=\"twitter:site\" content=\"@CodemotionIT\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Gilad David Maayan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/devops\\\/cloud\\\/working-with-spot-instances-on-aws-fargate\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/devops\\\/cloud\\\/working-with-spot-instances-on-aws-fargate\\\/\"},\"author\":{\"name\":\"Gilad David Maayan\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#\\\/schema\\\/person\\\/b332cfa429cd83ccb5840d43315f28c5\"},\"headline\":\"Working with Spot Instances on AWS Fargate\",\"datePublished\":\"2021-05-14T08:20:15+00:00\",\"dateModified\":\"2022-01-05T19:02:48+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/devops\\\/cloud\\\/working-with-spot-instances-on-aws-fargate\\\/\"},\"wordCount\":938,\"publisher\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/devops\\\/cloud\\\/working-with-spot-instances-on-aws-fargate\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2021\\\/05\\\/Working-with-Spot-Instances-on-AWS-Fargate.jpg\",\"articleSection\":[\"Cloud\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/devops\\\/cloud\\\/working-with-spot-instances-on-aws-fargate\\\/\",\"url\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/devops\\\/cloud\\\/working-with-spot-instances-on-aws-fargate\\\/\",\"name\":\"Working with Spot Instances on AWS Fargate - Codemotion Magazine\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/devops\\\/cloud\\\/working-with-spot-instances-on-aws-fargate\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/devops\\\/cloud\\\/working-with-spot-instances-on-aws-fargate\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2021\\\/05\\\/Working-with-Spot-Instances-on-AWS-Fargate.jpg\",\"datePublished\":\"2021-05-14T08:20:15+00:00\",\"dateModified\":\"2022-01-05T19:02:48+00:00\",\"description\":\"In this article, you'll see how to use AWS Fargate on EC2 spot instances for workloads that are not sensitive to the occasional interruption.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/devops\\\/cloud\\\/working-with-spot-instances-on-aws-fargate\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/devops\\\/cloud\\\/working-with-spot-instances-on-aws-fargate\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/devops\\\/cloud\\\/working-with-spot-instances-on-aws-fargate\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2021\\\/05\\\/Working-with-Spot-Instances-on-AWS-Fargate.jpg\",\"contentUrl\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2021\\\/05\\\/Working-with-Spot-Instances-on-AWS-Fargate.jpg\",\"width\":1200,\"height\":628,\"caption\":\"Working with Spot Instances on AWS Fargate\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/devops\\\/cloud\\\/working-with-spot-instances-on-aws-fargate\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"DevOps\",\"item\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/devops\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Cloud\",\"item\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/devops\\\/cloud\\\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Working with Spot Instances on AWS Fargate\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#website\",\"url\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/\",\"name\":\"Codemotion Magazine\",\"description\":\"We code the future. Together\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#organization\",\"name\":\"Codemotion\",\"url\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2019\\\/11\\\/codemotionlogo.png\",\"contentUrl\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2019\\\/11\\\/codemotionlogo.png\",\"width\":225,\"height\":225,\"caption\":\"Codemotion\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/Codemotion.Italy\\\/\",\"https:\\\/\\\/x.com\\\/CodemotionIT\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#\\\/schema\\\/person\\\/b332cfa429cd83ccb5840d43315f28c5\",\"name\":\"Gilad David Maayan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/aa7da1b7504794509c4f9347d4e7ea17f0b9ae2a84233ec171434f7c8511daf7?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/aa7da1b7504794509c4f9347d4e7ea17f0b9ae2a84233ec171434f7c8511daf7?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/aa7da1b7504794509c4f9347d4e7ea17f0b9ae2a84233ec171434f7c8511daf7?s=96&d=mm&r=g\",\"caption\":\"Gilad David Maayan\"},\"description\":\"Gilad David Maayan is a technology writer who has worked with over 150 technology companies including SAP, Imperva, Samsung NEXT, NetApp and Ixia, producing technical and thought leadership content that elucidates technical solutions for developers and IT leadership. Today he heads Agile SEO, the leading marketing agency in the technology industry.\",\"sameAs\":[\"https:\\\/\\\/www.linkedin.com\\\/in\\\/giladdavidmaayan\\\/\",\"https:\\\/\\\/x.com\\\/gilad_maayan\"],\"url\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/author\\\/gilad-david-maayan\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Working with Spot Instances on AWS Fargate - Codemotion Magazine","description":"In this article, you'll see how to use AWS Fargate on EC2 spot instances for workloads that are not sensitive to the occasional interruption.","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.codemotion.com\/magazine\/devops\/cloud\/working-with-spot-instances-on-aws-fargate\/","og_locale":"en_US","og_type":"article","og_title":"Working with Spot Instances on AWS Fargate","og_description":"In this article, you'll see how to use AWS Fargate on EC2 spot instances for workloads that are not sensitive to the occasional interruption.","og_url":"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/working-with-spot-instances-on-aws-fargate\/","og_site_name":"Codemotion Magazine","article_publisher":"https:\/\/www.facebook.com\/Codemotion.Italy\/","article_published_time":"2021-05-14T08:20:15+00:00","article_modified_time":"2022-01-05T19:02:48+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2021\/05\/Working-with-Spot-Instances-on-AWS-Fargate.jpg","type":"image\/jpeg"}],"author":"Gilad David Maayan","twitter_card":"summary_large_image","twitter_creator":"@gilad_maayan","twitter_site":"@CodemotionIT","twitter_misc":{"Written by":"Gilad David Maayan","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/working-with-spot-instances-on-aws-fargate\/#article","isPartOf":{"@id":"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/working-with-spot-instances-on-aws-fargate\/"},"author":{"name":"Gilad David Maayan","@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/b332cfa429cd83ccb5840d43315f28c5"},"headline":"Working with Spot Instances on AWS Fargate","datePublished":"2021-05-14T08:20:15+00:00","dateModified":"2022-01-05T19:02:48+00:00","mainEntityOfPage":{"@id":"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/working-with-spot-instances-on-aws-fargate\/"},"wordCount":938,"publisher":{"@id":"https:\/\/www.codemotion.com\/magazine\/#organization"},"image":{"@id":"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/working-with-spot-instances-on-aws-fargate\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2021\/05\/Working-with-Spot-Instances-on-AWS-Fargate.jpg","articleSection":["Cloud"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/working-with-spot-instances-on-aws-fargate\/","url":"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/working-with-spot-instances-on-aws-fargate\/","name":"Working with Spot Instances on AWS Fargate - Codemotion Magazine","isPartOf":{"@id":"https:\/\/www.codemotion.com\/magazine\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/working-with-spot-instances-on-aws-fargate\/#primaryimage"},"image":{"@id":"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/working-with-spot-instances-on-aws-fargate\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2021\/05\/Working-with-Spot-Instances-on-AWS-Fargate.jpg","datePublished":"2021-05-14T08:20:15+00:00","dateModified":"2022-01-05T19:02:48+00:00","description":"In this article, you'll see how to use AWS Fargate on EC2 spot instances for workloads that are not sensitive to the occasional interruption.","breadcrumb":{"@id":"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/working-with-spot-instances-on-aws-fargate\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/working-with-spot-instances-on-aws-fargate\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/working-with-spot-instances-on-aws-fargate\/#primaryimage","url":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2021\/05\/Working-with-Spot-Instances-on-AWS-Fargate.jpg","contentUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2021\/05\/Working-with-Spot-Instances-on-AWS-Fargate.jpg","width":1200,"height":628,"caption":"Working with Spot Instances on AWS Fargate"},{"@type":"BreadcrumbList","@id":"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/working-with-spot-instances-on-aws-fargate\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.codemotion.com\/magazine\/"},{"@type":"ListItem","position":2,"name":"DevOps","item":"https:\/\/www.codemotion.com\/magazine\/devops\/"},{"@type":"ListItem","position":3,"name":"Cloud","item":"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/"},{"@type":"ListItem","position":4,"name":"Working with Spot Instances on AWS Fargate"}]},{"@type":"WebSite","@id":"https:\/\/www.codemotion.com\/magazine\/#website","url":"https:\/\/www.codemotion.com\/magazine\/","name":"Codemotion Magazine","description":"We code the future. Together","publisher":{"@id":"https:\/\/www.codemotion.com\/magazine\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.codemotion.com\/magazine\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.codemotion.com\/magazine\/#organization","name":"Codemotion","url":"https:\/\/www.codemotion.com\/magazine\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/logo\/image\/","url":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/11\/codemotionlogo.png","contentUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/11\/codemotionlogo.png","width":225,"height":225,"caption":"Codemotion"},"image":{"@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/Codemotion.Italy\/","https:\/\/x.com\/CodemotionIT"]},{"@type":"Person","@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/b332cfa429cd83ccb5840d43315f28c5","name":"Gilad David Maayan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/aa7da1b7504794509c4f9347d4e7ea17f0b9ae2a84233ec171434f7c8511daf7?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/aa7da1b7504794509c4f9347d4e7ea17f0b9ae2a84233ec171434f7c8511daf7?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/aa7da1b7504794509c4f9347d4e7ea17f0b9ae2a84233ec171434f7c8511daf7?s=96&d=mm&r=g","caption":"Gilad David Maayan"},"description":"Gilad David Maayan is a technology writer who has worked with over 150 technology companies including SAP, Imperva, Samsung NEXT, NetApp and Ixia, producing technical and thought leadership content that elucidates technical solutions for developers and IT leadership. Today he heads Agile SEO, the leading marketing agency in the technology industry.","sameAs":["https:\/\/www.linkedin.com\/in\/giladdavidmaayan\/","https:\/\/x.com\/gilad_maayan"],"url":"https:\/\/www.codemotion.com\/magazine\/author\/gilad-david-maayan\/"}]}},"featured_image_src":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2021\/05\/Working-with-Spot-Instances-on-AWS-Fargate-600x400.jpg","featured_image_src_square":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2021\/05\/Working-with-Spot-Instances-on-AWS-Fargate-600x600.jpg","author_info":{"display_name":"Gilad David Maayan","author_link":"https:\/\/www.codemotion.com\/magazine\/author\/gilad-david-maayan\/"},"uagb_featured_image_src":{"full":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2021\/05\/Working-with-Spot-Instances-on-AWS-Fargate.jpg",1200,628,false],"thumbnail":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2021\/05\/Working-with-Spot-Instances-on-AWS-Fargate-150x150.jpg",150,150,true],"medium":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2021\/05\/Working-with-Spot-Instances-on-AWS-Fargate-300x157.jpg",300,157,true],"medium_large":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2021\/05\/Working-with-Spot-Instances-on-AWS-Fargate-768x402.jpg",768,402,true],"large":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2021\/05\/Working-with-Spot-Instances-on-AWS-Fargate-1024x536.jpg",1024,536,true],"1536x1536":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2021\/05\/Working-with-Spot-Instances-on-AWS-Fargate.jpg",1200,628,false],"2048x2048":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2021\/05\/Working-with-Spot-Instances-on-AWS-Fargate.jpg",1200,628,false],"small-home-featured":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2021\/05\/Working-with-Spot-Instances-on-AWS-Fargate.jpg",100,52,false],"sidebar-featured":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2021\/05\/Working-with-Spot-Instances-on-AWS-Fargate-180x128.jpg",180,128,true],"genesis-singular-images":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2021\/05\/Working-with-Spot-Instances-on-AWS-Fargate-896x504.jpg",896,504,true],"archive-featured":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2021\/05\/Working-with-Spot-Instances-on-AWS-Fargate-400x225.jpg",400,225,true],"gb-block-post-grid-landscape":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2021\/05\/Working-with-Spot-Instances-on-AWS-Fargate-600x400.jpg",600,400,true],"gb-block-post-grid-square":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2021\/05\/Working-with-Spot-Instances-on-AWS-Fargate-600x600.jpg",600,600,true]},"uagb_author_info":{"display_name":"Gilad David Maayan","author_link":"https:\/\/www.codemotion.com\/magazine\/author\/gilad-david-maayan\/"},"uagb_comment_info":0,"uagb_excerpt":"AWS Fargate is a popular cloud service that lets you run containers in a serverless model\u2014without having to manage the underlying server infrastructure. In this article, you&#8217;ll see how to use Fargate with a twist: running Fargate on EC2 spot instances and getting substantial discounts, for workloads that are not sensitive to the occasional interruption.&#8230;&hellip;","lang":"en","_links":{"self":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts\/14693","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/users\/100"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/comments?post=14693"}],"version-history":[{"count":7,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts\/14693\/revisions"}],"predecessor-version":[{"id":16247,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts\/14693\/revisions\/16247"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/media\/14772"}],"wp:attachment":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/media?parent=14693"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/categories?post=14693"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/tags?post=14693"},{"taxonomy":"collections","embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/collections?post=14693"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}