{"id":44758,"date":"2017-02-16T11:52:46","date_gmt":"2017-02-16T06:22:46","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=44758"},"modified":"2017-02-24T13:17:06","modified_gmt":"2017-02-24T07:47:06","slug":"aws-cost-optimization-series-blog-1-100k-to-40k-in-90-days","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/aws-cost-optimization-series-blog-1-100k-to-40k-in-90-days\/","title":{"rendered":"AWS Cost Optimization Series | Blog 1 | $100K to $40K in 90 Days"},"content":{"rendered":"<p style=\"text-align: justify\">Amazon Web Services (AWS) has significantly changed the IT world as more and more companies are adopting AWS for hosting their QA, Dev, Stage, Prod workloads. This has led to an increase in their monthly AWS spent and there comes a need to re-examine their cloud strategy to bring these costs down. It is a five blog series, I will be sharing a Use Case of a client and how we managed to reduce their monthly AWS spent by multiple folds.<\/p>\n<p style=\"text-align: justify\">One of the nation&#8217;s biggest online deals platform with a presence in 35+ cities enables customers and merchants to discover and engage with each other for fine dining, relaxing at the top spas, or discovering and traveling to the\u00a0city. The platform also offers its merchants a strong branding platform that enables customers, in and around their establishments, to easily discover their businesses.<\/p>\n<p style=\"text-align: justify\">In the initial days, the client&#8217;s infrastructure setup and maintenance activities were being carried out by the application team without any <a title=\"devOps on AWS\" href=\"http:\/\/www.tothenew.com\/devops-aws\">DevOps<\/a> perspective that\u00a0cost the client enormous time, effort and money. Therefore, the\u00a0client wanted to standardize the infrastructure components, implement scalable solutions and maximize automation wherever possible in order to reduce operational and maintenance cost.<\/p>\n<p style=\"text-align: justify\">The client engaged <a title=\"Product Engineering Partner\" href=\"http:\/\/www.tothenew.com\/\">TO THE NEW<\/a> as a trusted DevOps service provider to help them reduce the infrastructure costs. In <span style=\"color: #000000\">our client\u00a0<\/span>ecosystem, we have microservices architecture with 50+ services and every service in <span style=\"color: #000000\">their <\/span>ecosystem comprised of a load balancer, two application instances with auto scaling, and a 3 node MongoDB replica set. Our application stack majorly<span style=\"color: #000000\"> leverages Java<\/span>, but we had also adopted Node js and Angular js for our frontend apps. For managing database, we were mostly using NoSQL databases (MongoDB and Elasticsearch), but for transaction\u00a0purposes, we were using Postgresql. Apart from the above-mentioned technologies, we are using Apache Kafka for event-based notifications and Hbase for preference engine.<\/p>\n<p style=\"text-align: justify\"><strong>How we identified the scope of Cost Optimizations<\/strong><\/p>\n<p style=\"text-align: justify\">The business requirement was pretty straight forward i.e. they wanted a web application that can handle high traffic and can scale independently, therefore the engineering team decided to go head with microservices architecture as it gives individual teams the flexibility to scale and develop new features independently.<\/p>\n<p style=\"text-align: justify\">In the initial days of our engagement with the customer, in the beginning, we implemented open source monitoring tool as <a title=\"aws managed services\" href=\"http:\/\/www.tothenew.com\/devops-aws\">AWS cloud<\/a> watch doesn\u2019t provide memory and hard disk utilizations. After analyzing the report for the last 15-21 days, we were able to get more insights about the existing infrastructure. Few stats are given below from the report:<\/p>\n<ul>\n<li style=\"text-align: justify\">Average CPU utilization of all the instances was below 25% and maximum was 35%<\/li>\n<li style=\"text-align: justify\">Average Memory utilization of all the instances was below 35% and maximum was 43%<\/li>\n<li style=\"text-align: justify\">Average Disk utilization was about 20-25%<\/li>\n<\/ul>\n<p style=\"text-align: justify\">After looking at the stats above, we were able to make our cost optimization roadmap with cloud aggressive approach in mind. (by cloud aggressive approach, I mean running all the AWS Resources at 75-80% utilization rates and after crossing that threshold it can automatically scale). In the roadmap, we decided to divide the entire cost optimization activity into 4 steps based on the cost savings. These four steps are explained further in detail below:<\/p>\n<ol>\n<li style=\"text-align: justify\"><strong><span style=\"font-weight: 400\"><strong><strong>Ways to Cut Cost with Infrastructure Monitoring: \u00a0<\/strong><\/strong><\/span><\/strong><span style=\"font-weight: 400\">Monitoring system provided us detailed insights about our infrastructure with the help of which, we were able to identify\u00a0<\/span><span style=\"font-weight: 400\">underutilized and idle resources. <a title=\"Cloud Infrastructure Monitoring\" href=\"http:\/\/www.tothenew.com\/blog\/datadog\/\">Monitoring<\/a> became the key factor for entire cost optimization.<\/span><\/li>\n<li style=\"text-align: justify\"><strong>How we generated 30% cost savings on Application Hosting with AWS ECS Migration:<\/strong> Every new service request required 2 application servers to be provisioned with auto scaling and adding 3-4 new services every month resulted in adding 8-12 EC2 instances which increased monthly AWS billing. To solve this ever ending problem, we started playing with Kubernetes and ended up using AWS ECS.<\/li>\n<li style=\"text-align: justify\"><strong>MongoDB Consolidation and RDS optimizations helped save 76% of our database spent:<\/strong> As most of the infrastructure was provisioned by the application team, it lacked basic kernel, limits, and MongoDB tuning. After looking at the MongoDB utilization reports we starting categorizing MongoDB on the basis of throughput and availability. i.e. High-throughput systems were kept in the separate cluster and all the internal application databases were kept on the same cluster as the business also\u00a0didn&#8217;t mind slight downtimes for the internal applications.<\/li>\n<li style=\"text-align: justify\"><strong>Save 80% on Dev, QA, Stage and Test Environment Cost on AWS with Spot Instances:<\/strong> As discussed earlier, we migrated all our applications in QA, STAGE, and PROD to AWS ECS. After going through the blog \u201c<a title=\"Powering your Amazon ECS Clusters with Spot Fleet\" href=\"https:\/\/aws.amazon.com\/blogs\/compute\/powering-your-amazon-ecs-clusters-with-spot-fleet\/\" target=\"_blank\">Powering your Amazon ECS Clusters with Spot Fleet<\/a> \u201d, we started playing with the spot instances and after 30 days <span style=\"color: #000000\">we had<\/span> started using Spot instances to power our ECS and Elasticsearch Clusters that resulted in huge cost savings.<\/li>\n<\/ol>\n<p><strong>Overall Cost Comparison:<\/strong><\/p>\n<table>\n<tbody>\n<tr>\n<td><\/td>\n<td><strong>Before (in $ per month)<\/strong><\/td>\n<td><strong>After 3 months (in $ per month)<\/strong><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">EC2<\/span><\/td>\n<td><span style=\"font-weight: 400\">65k<\/span><\/td>\n<td><span style=\"font-weight: 400\">39k<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">RDS<\/span><\/td>\n<td><span style=\"font-weight: 400\">30k<\/span><\/td>\n<td><span style=\"font-weight: 400\">7k<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Data Transfer<\/span><\/td>\n<td><span style=\"font-weight: 400\">3k<\/span><\/td>\n<td><span style=\"font-weight: 400\">2k<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Cloudfront<\/span><\/td>\n<td>2k<\/td>\n<td><span style=\"font-weight: 400\">2k<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Total<\/span><\/td>\n<td><b>100k<\/b><\/td>\n<td><b>40k<\/b><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-44759\" src=\"\/blog\/wp-ttn-blog\/uploads\/2017\/01\/Screen-Shot-2017-01-03-at-1.12.01-PM.png\" alt=\"AWS Cost Comparison\" width=\"1560\" height=\"1036\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2017\/01\/Screen-Shot-2017-01-03-at-1.12.01-PM.png 1560w, \/blog\/wp-ttn-blog\/uploads\/2017\/01\/Screen-Shot-2017-01-03-at-1.12.01-PM-300x199.png 300w, \/blog\/wp-ttn-blog\/uploads\/2017\/01\/Screen-Shot-2017-01-03-at-1.12.01-PM-1024x680.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2017\/01\/Screen-Shot-2017-01-03-at-1.12.01-PM-624x414.png 624w\" sizes=\"(max-width: 1560px) 100vw, 1560px\" \/><\/p>\n<p>As you can see from the above stats, we made significant cost savings after implementing the four points we discussed earlier in our roadmap. In the next blog, we will be discussing\u00a0<strong>&#8220;<a title=\"AWS Cost Optimization Blog 2\" href=\"http:\/\/www.tothenew.com\/blog\/aws-cost-optimization-series-blog-2-infrastructure-monitoring\/\">AWS Cost Optimization Series | Blog 2 | Monitor &amp; Optimize<\/a>&#8221;\u00a0<\/strong>and how it became the key factor for cost optimization.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Amazon Web Services (AWS) has significantly changed the IT world as more and more companies are adopting AWS for hosting their QA, Dev, Stage, Prod workloads. This has led to an increase in their monthly AWS spent and there comes a need to re-examine their cloud strategy to bring these costs down. It is a [&hellip;]<\/p>\n","protected":false},"author":216,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":18},"categories":[1174,2348,1],"tags":[2122,248,4425,4426],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/44758"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/216"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=44758"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/44758\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=44758"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=44758"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=44758"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}