How to reduce your cloud costs?

How to reduce your cloud costs?

This article explains how Back4App reduced their AWS cloud costs from $55k per month to $20k per month and accomplished more than 500k yearly savings. This article will also provide you with our experience-based practical advice for AWS cost management along with some tips that work in our case.

AWS has developed so much that it has to turn out to be a significant part of the Amazon strategy. Being an enthusiastic user of AWS, my concerns about its cost and complexity have headed me to search for different ways to optimize cloud usage. Although it offers an increasingly sophisticated set of services yet it is not the most straightforward, fastest, or most affordable option. This demand for a personalized architecture to optimize costs once you have moved to the cloud. 

Follow this guide to accelerate the optimization of AWS costs. The article will provide you with the following details.

  • Ask for AWS credits, and earn up to $ 100k
  • Utilize spot instances and save up to 90%;
  • Buy reserved elastic cache nodes to save up to 77%;
  • Go for the new AWS savings plan to save up to 72%.
  • Move to Cloud Front and save up to 75%;
  • Use a private IP, and there is no need to pay for data transfer data between A to Z;
  • Reduction of data transfer expenses with the implementation of the GraphQL API;
  • Buy reserved instances on the AWS market to save up to 75%;
  • Save your data on S3 rather than EBS to save 75%;
  • Apply auto-scaling for inactive resources;
  • Choose Northern Virginia and get away from Tokyo.
  • Upgrade to new generation families, saving up to 20%
  • Place the S3 endpoint on your VPC and the optimized network activation on EC2.

Our AWS Invoice in January 2019

Our AWS Invoice in May 2019

1. Ask for AWS cloud credits

Make sure your business is eligible for AWS credits! Before moving forward, it is essential to check if your business is eligible for AWS credits. If the answer is yes, you can ask AWS for credits. Let’s first take a look at our case in 2016. 

Our company was developing quickly, and as a result, the AWS bill started to rise. At that time, we had no time or even and idea of AWS costs optimization. The company didn’t have any money and the only option to save the company was to get AWS credits. 

We prepared a business case for our account manager which shows our growth and the benefits of maintaining an AWS account. We showed him that we had no money and that we had to move to Google Cloud unless we got the credits. After one week, AWS provided us with $ 100,000 credits for a year.  That was an amazing deal for AWS too. After the credits expired, we consumed more $ 750k in cloud expenses.

Credits for Proof of Concept and Testing

If you’re testing a new type of AWS service, request credits from the AWS Account Manager, the amount of credits will vary based on your monthly expenses and your overall efforts for POC implementation. Ensure to speed up the POC as these credits are only available for three months.  

Credits for Startups

If you’re starting your own business or have a startup, it’s a great way to grow. Credits range from $ 1k to $ 100k, depending on how you send your order to AWS. There are two ways to get these credits.

Startup Accelerator provides many perks and is a significant benefit. One of the benefits is the balances of cloud service providers.

 The amount will vary reliant on the approved accelerator. Top accelerators like Alchemist, Wayra, 500 Startups and YC will offer you 100,000 in AWS credits. AWS does not facilitate you to add the credits. If you are accepted into two acceleration programs and earned $100k each but you could not use $200k. 

VC Funds & Angel Groups can also help you as they offer amazing benefits. Some Angel Groups / VC will offer cloud credits as a part of the benefits package. We got a promotional credit of $ 10,000 that was valid for two years. Companies are not entitled to AWS promotional credits if they have already received the same or higher credit amount.

All the leading cloud players will provide credits to startups. At AWS, the credits will be $ 100,000 while you can get $ 360,000 for three years at Azure.

2. Have cloud cost reduction routine

Coming to the harder part, remember that cutting AWS costs is not magic, you will have to work hard and get a regular cost control routine. Cutting the cost of the cloud should be part of your daily routine.  

The time you spend is directly proportional to the AWS spending and your organization size. You may have to spend 30 minutes a day observing the account and prioritizing cost reduction actions.  Back4App engineers spend minimum an hour a day implementing initiatives for cost reduction.

Here is a list of actions we implemented 

  • Create a basic Excel spreadsheet
  • Rank the initiatives for cost reduction.
  • Identify the main variables for savings

These variables were the availability of costs saving actions, complexity and the owner. As far as our case is concerned, most of the savings were related to the use of Cloud Compute Cloud, making it the first component to tackle.

3. Reduce EC2 Costs

Terminate Instances

The first thing to do to reduce EC2 spending is to terminate unused instances. It is a simple process. All you have to do is list all of your instances, download a free Excel sample, and organize them all. In our case, we classify our instances into different categories.

Instances that must remain active second are the instances that can be stopped and third is the instances that can be ended. End unused instances as much as possible. If you deactivate it, EBS costs will still be running. 

Reduce oversized resources

This procedure is somewhat complicated, and it is necessary to assess the size of the instance correctly. Be sure to evaluate at least a week of data to increase the likelihood that the instance is correctly identified. 

We controlled it by classifying instances into three primary categories. The right size, reduce the size of the instance, increase the size of the instance. The method of verifying historical data, for instance, is straightforward, and in your AWS dashboard, you must go to EC2, Services,   Executing instances, Instances, Specify an instance, and monitoring.

Make sure to reduce the instance size gradually. Reducing the size of the instance gradually will help you in many ways. For example, do not reduce the size of t3.xlarge to t3.medium. Reduce the t3.2xlarge to t3.xlarge. Watch for a week, check the amount of resources used, and repeat the cutting cycle. This will reduce your chances of quitting work or making mistakes.

Make use of the reserved instances

Instance reservations can save you up to 70%.  While instance reservation, you will pay 24/7 usage for the entire period reserved whether you are using or not using the resources. 

Standard and Convertible are the two types of reserved instances. In case of standard type, you can sell on the AWS Marketplace, and you cannot convert to a different kind of instance. This is cheaper than the convertible instances. In case of convertible instances, you cannot be sold on the AWS Marketplace; it can be converted to another type of instance, more costly than the standard instances.

Convertible instances can be tricky

Convertible instances are very complicated.  Each time you convert an instance, you can only upgrade usage.  To clear this concept, let’s take an example. 

You have purchased a reserved i3.medium convertible instance and decided to change the i3.medium instance to the i3.large instance. You can do that, and after some time, if you want to revert to the original i3.medium instance, this is not possible. You cannot refer to a convertible instance, but only enhance the sum you spend on it. 

Be sure, to begin with, the small convertible instances over time. Do not start with a large instance because you cannot refer to it or sell it on the AWS market. In case of a mistake with the convertible instances, you are obliged to pay a monthly period of 12 or 36 months.  At Back4App, how we handle convertible instances is to get t3.nano and update it if necessary.

The best-reserved instances are standard compared to convertible reserved instances because of different reasons; cheaper, liquidity and discount. 

Use the AWS savings plan

AWS launched this new pricing model on the 6th of November, 2019 and it appears to be an excellent way to save computing power. These pricing models offer low usage rates for Fargate and EC2, as opposed to a promise of continuous use over a year or three. When subscribing to savings plans, the price will be applied to the price of savings plans discounted for your use until your commitment. If you commit to $10 to use EC2 per hour, you will save from this saving plan on the usage of up to $10, and extra charges will be added as per the rates if the engagement exceeds.

  • Access the billing management console
  • On the left side, find and tap on a savings plan.
  • Different pages will be opened
  • At the top left, click on Buy a savings plan.
  • You must now choose between a savings account and an EC2 savings plan. Compute is a good option as it offers more flexibility.
  • The next step is to select the commitment duration. You can choose from one year and three years’ options. Three-year plan is good from saving points of view.
  • Next, select hourly commitment. Choosing a commitment of $ 0.01 / hour for duration of 3 years is preferable. This will mean an initial cost of $ 262.80.
  • Add it to the cart.
  • A new page containing the purchase information will be opened.
  • Click on the submit order.
  • You will start to save money on the full power of your computer. It does not matter the region, the type of instance, the size of the instance, or the possession. 

Use AWS Marketplace for Reserved Instances

Reserved instances are fantastic but the reserved instances bought from AWS are better. The AWS market is like a stock market. Sometimes you can buy standard reserved instances at very reasonable prices compared to purchasing directly from AWS. The reason is simple. Sometimes businesses have unnecessary situations that they no longer use and continue to pay for. Lowering the price list is a great way to speed up the sale.

AWS Marketplace Offers Flexible Purchase Conditions

With AWS Marketplace, you can buy samples on flexible terms. AWS only offers 12 months / 36 months of options to purchase reserved instances. 

The AWS market is more flexible.  For example, you can buy instances that have been reserved for 15 months for the same price as 36 months. Some companies buy long-term reservations (36 months), and before the end of the reservation period, they sell instances on the AWS market. The new purchaser will use the instance only for the rest. 

If the reserved duration is 36 months and the purchaser utilize the instances for 21 months. Second buyer will buy at the market and use it for another 15 months. The actual challenge is to find available instances to purchase on the Market. A great way to boost your chances of finding the instances is to search for instances in multiple Availability Regions, not just the Availability Zone where your instances are located. Once purchased, you can modify an instance and assign it to a different zone, or convert it to a regional instance. The procedure is very simple and follows the procedure step by step 

  • Access the reserved instances panel
  • Click on the Purchase Reserved Instances
  • Select Standard on offering a class
  • On the upper left corner of the pop-up window, select “Only show offerings that reserve capacity”.
  • Click on the Search
  • Buy an Instance in Availability Zone 1b
  • Wait till instance is active
  • Specify the purchased instance
  • Click on the Actions button
  • Click on Edit Reserved Instances
  • Scope – Change from A to Z or select a region
  • Click on “Continue”
  • Click Submit Modifications

By following these steps, you can purchase standard reserved instances from any Availability Zone and modify them to suit your Availability Zone.

AWS marketplace for non-US companies

Below is a valuable guide for users without a US legal entity. You will not be able to sell standard reserved instances in the market unless it has a United States legal entity.  If you run your business outside of the United States of America, you will only be able to buy instances on the marketplace; however, you cannot sell it.

Use spot instances

Save up to 90% by using spot instances and requires no long term commitment.  The only downside to similar points is that AWS can end these cases with little or no warning. Therefore, this kind of instance should only be used for workloads that have errors or are flexible.

Use SpotInst for spot instances

A better strategy to run instant situations and reduce your risk of downtime is to go for SpotInst platform. This service will be linked to your AWS account and handle Spot Instance allocation. If AWS terminates an instance, this service will replace the instance with On Demand and avoid interruption. The price is also very smart, charging 20% net savings.

A great use case for Spot instances is to execute secondary database servers and scale applications automatically. Use SpotInst to manage the allocation of points, and you will likely not experience any downtime from using this type of offer.

Autoscaling best practices

AWS Auto Scaling observes your applications and adjusts capacity to keep stable and predictable performance automatically at the lowest possible cost. Configure automatic scaling to automate the starting and stopping of instances of EC2. Auto-scaling groups take into account resource usage such as API requests, start/end times, and CPU.

To fully reduce costs, you should use Autoscaling + Spot Instances + Reserved examples. Let’s see the real situation we face here in Back4App. The workloads on our application servers vary throughout the day. The number of requests we receive is not fixed and ends with use at specific times of the day. The way we deal with this problem is to define reserved baseline instances to use at a minimum and develop them with specific instances. The image is useful for understanding the configuration.  

To get the idea of how much you can save, take a look

Reserved Instances

At Back4App, having a mix of standard reserved instances for 12 months or 36 months. The average savings will be 50% compared to the on-demand costs.

Autoscaling

You can start or stop the instances based on the total number of API requests received by each instance. We have three periods of maximum use during the day, and savings compared to maintaining inactive resources operating 24 hours with a maximum workload of around 75%.

Spot Instances

You will have a mix of two types of families running Spotinst to increase availability. Our net savings are 55% over prices on request. These are our net savings and the total amount we have to pay to SpotInst. Running instant instances directly on AWS will save you almost 70% in savings, but increase your availability risk. Thus to play safe, part of savings is given to Spotinst. 

Choose the right AWS region

Cloud costs will be different depending on your region! For example, Sao Paulo is roughly 100% more expensive in comparison to North Virginia.

  • Select the right AWS region to reduce costs.
  • Choosing the wrong will end up paying more.
  • Northern Virginia, Oregon, and Ohio are the cheapest regions.
  • Sao Paulo, Hong Kong, and Sydney are the most expensive regions.

Upgrading resources of previous generation

AWS launches new types of instances from time to time. Instances of new generation are more reasonable and have more processing power. New generation instance are around 15% cheaper and have a processing capacity 6% higher.

EC2 Pro Tip

Activate the enhanced network if you want to get the best results. Activate optimized networks for better optimal performance!

4. Elastic Block Store – EBS

EBS provides fixed block storage sizes for use with EC2 instances in the AWS cloud. Each Amazon EBS volume is copied to the Availability Zone to protect it from component failure, providing high availability and durability. The cost of each gigabyte stored depends on the type of volume that will store the data. General Purpose SSD and Magnetic are most commonly used volumes.

Type EBS – SSD x magnetic

Begin mapping EC2 instances and download the spreadsheet for help. For every instance, determine whether the volume is SSD or magnetic. SSD volumes are twice as expensive as Magnetic volumes! Go for Magnetic on SSD as much as possible and try to replace SSD volumes. 

EBS size – Reduction of large volumes

The second procedure to save EBS costs is to limit the size of each attached volume. It is very common to have large volumes as well as unused capacity. You can download the spreadsheet to learn more.

Terminate the Instances — Stop will keep EBS Costs

Stopping a proceeding will not prevent you from obtaining EBS costs. Your file will continue to be stored, and the invoice will generate. If you no longer need the instance and the data, end the instance. This action will end the costs of EC2 and EBS.

AWS will increasingly allow you to increase the size of EBS, but it will not allow you to reduce it. In general, it is better to have smaller sizes rather than larger sizes and to use EBS sizes only when necessary.

Ephemeral storage evaluation

Assess the advantages and disadvantages of temporary storage. On the professional side, you will not face any hidden costs in EBS, you will get less latency, and you will be able to get discounts for the reserved instances. On the other hand, you may not be using all of the available internal storage and spot instances implementations will be more complicated.

Delete Unattached Volumes

Another procedure that will save you money is to delete unused and offline files simply.

Use S3 to back up your data

EBS is at least double the cost of S3. In general, it is better to save your data on S3 rather than on EBS. Also, make sure that your backups are running gradually and delete them periodically.

5. Elastic Cache — Reserved Nodes 

You can buy Elastic Cache reserved instances to enjoy excellent savings.

Get a 65% discount on one year reservation and a 77% discount on three years reservation.

The procedure is similar to obtaining EC2 reserved instances. To get a reserved node, do the following:

  • Go to the Elastic Cache
  • Access the reserved nodes
  • Click on the blue button “Buy a reserved node” at the top right
  • Select Memcached or Redis
  • Select the type of node
  • Specify the duration (1 or 3 years)
  • Type of offering; light, medium or heavy
  • Click on Next

The other cost related actions are same as EC2. Unused nodes should be closed, and the large nodes should be reduced.

Keep it in mind that there is no market for reserved nodes.  Before buying, be sure to use the node for a minimum of 1 year.

6. AWS Data Transfer Costs

The cost variable can get out of hand very quickly. Its management is very complex and difficult to detect in terms of data flow. In addition, there are several types of data transmission. For example, data transfer, interregional transfer, A to Z transfer, S3 data transmission, etc.  How will AWS data transfer costs be reduced? Follow these steps to reduce the transfer costs

Connect S3 endpoints to Cloudflare or another CDN service

This simple procedure can reduce your S3 data transfer costs by five times depending on the amount of cache you have.

Elastic IPs- Try to choose your private IP address 

The AWS price calculator indicates that data transfer is free for EC2 cases, but it also contains an entry box for “Elastic IP/ Public IP Data Transfer.” If you select to communicate using Elastic or Public IP address or elastic load balancer within the Amazon EC2 network, you will pay for data transfer in the region even if the instances are in the same availability area. To transfer data in the same Availability Zone, you can easily avoid these costs by using your IP whenever possible.

Use single AZ – Availability zones

Use single AZ as an alternative of multiple AZs for other significant savings. Avoid or stop data transfer between regions.

Implement the GraphQL API

One of the important advantages of GraphQL is reduced recovery and therefore data transfer. Replacing REST can be a difficult task depending on the structure of your application, and it is essential to estimate the potential for cost reduction before proceeding. Another substitute is to implement GraphQL incrementally for new projects or functionalities.  

Discount on data transfer volume

It’s quite difficult and the volume you need is incredibly high. This action can only be applied to enterprises or large accounts.

Use CloudFront

You can make big savings by implementing this action! This will also improve the performance of your application and reduce overall latency. It’s an implementation where everyone wins.  

7. Cloudfront

On-demand costs for the Cloudfront are reduced fairly as soon as their volume increases. Take a 100 TB data transfer. This will cost $ 0.060 / GB, which is about 15% less than the same ELB data transfer volume.

AWS wants to take advantage of its CloudFront service, and, depending on its volume, you can minimize the CloudFront transfer at a rate of $ 0.02 / GB. Chances are it will take a two-year commitment, and if you plan to use AWS for a while, it’s a great way to do it. To proceed, you must contact your account manager and request a CloudFront private agreement.

Check if you are utilizing Amazon CloudFront SSL-Cert-Custom certificate. It costs $ 20 / day, and you can get the same certificate with Cloudflare for $ 25 / month. With the Private as well as the Volume Pricing Agreement, you will not be able to connect to other CDN services.

8. S3 – Simple storage service

Here are some helpful tips for reducing S3 costs.

One great cost-cutting initiative that most people don’t use is the S3 VPC endpoint. By placing the S3 endpoint in the VPC, all traffic to the S3 is your internal route, and AWS will not charge you as a public pass. Depending on the volume, it is thus possible to make cuts on the order of thousands of dollars per month.

Make use of the correct storage model and the right class of storage.

There are five storage models:

S3 standard

The characteristics of the S3 standard are listed below

  • $ 0.023 / GB
  • Redundancy by AZ
  • High throughput and low latency
  • Resistant to events that affect the entire availability zone

S3 Infrequent Access

  • $ 0.0125 / GB
  • Ideal for the long-term storage and backup and as a data store for disaster recovery data files.
  • Redundancy by AZ
  • Infrequent access

S3 One-Zone Infrequent Access

  • $ 0.010 / GB
  • Single AZ
  • Infrequent access
  • A great option for storing secondary backups

S3 Glacier

  • $ 0.004 / GB
  • Low cost, durable, and secure storage class for archiving data.
  • Redundancy by AZ
  • Recovery options vary from a few minutes to a few hours.

S3 Glacier Deep Archive

  • $ 0.099 / GB
  • A low-cost storage category that supports long-term storage and digital storage of accessible data once or twice a year.
  • Recovery time within 12 hours.- Redundancy across AZ

S3 API Costs

S3 API costs can be complicated. Every time you move items from one storage category to another, you will be charged based on the number of orders. 

Here is a scenario that occurred in Back4App. One of the clients stores millions of small objects it is rarely recovered. Initially, we stored these objects on S3 standard and decided to transfer them to S3 Glacier to cut the costs.

What we didn’t know was that AWS was charging $ 0.05 for 1,000 orders of glaciers. In this case, the number of objects was enormous and the size of each object was very small. So the initial cost we encountered was not worth it. Prior to moving objects between the storage classes, it is necessary to consider the costs associated with S3 orders and perform the return on investment analysis.

Delete unused S3 data. The simplest and most cost-effective method for S3 is simply to delete old and unused data. Check for old backups and unused S3 cubes. Perform analyzes and delete data if possible.

9. AWS Support Levels

AWS offers different support levels

  • Basic – free
  • Developer: $ 29 / month or 3% of the monthly invoice
  • Business: $ 100 / month or 10% -3% of the bill on a monthly basis depending on the size
  • Enterprise: $ 15,000

Based on our experience, Business support is not satisfactory in terms of cost. It costs too much when compared with the assistance and support it provides.  

Use AWS Regional Account Manager

Use regional account manager and solution engineer as much as possible. They are separated from the central support team and will be able to provide more personalized service. The AWS team is very competent and helpful. The advice they gave us in terms of advanced security configuration and implementation of the general data protection regulation was the best in its class.   This support will make you think twice before moving on to other cloud service providers.

10. Monitoring and control

It is extremely important to maintain a strict billing system and to know your daily expenses. You need to provide detailed tracking of your costs and spend time seeing it every day.  Daily monitoring will assist you in identifying suspicious uptrends and taking action as soon as possible. The best monitoring and control practices are described below:

  • Regular monitoring
  • Billing and cost management panel
  • Monthly invoices
  • Cost Explorer 
  • Cost Explorer: use of RI
  • Cost explorer: RI coverage
  • Tag everything
  • Measure Baseline, Alert On Exceptions, Monitor
  • Create a model of responsibility
  • Use Cloudwatch and a trusted advisor to monitor costs
  • Merge your invoices and get volume reductions

11. Cloud Architecture redesign

The redesign of the structure is often the long step to implement. It can take weeks or months, depending on the size/complexity of your infrastructure.

Our Back4app experience shows that there are several simpler steps to follow before this step. Take advantage of these savings first and gain exposure to implement the best architectural design in its class.

12.Conclusion

Reducing AWS costs requires effort and time. You need to create a routine to control your spending, prioritize your cost savings, and act enthusiastically to achieve your AWS savings goals. Below is a review of the procedures that have helped us reduce the AWS bill.

  • Terminate the unused EC2 instances
  • Move the data transfer flow to CloudFront
  • Reduction of large AWS instances
  • Upgrade to next-generation instances
  • Implement best practices as an improved network
  • Data backup on S3
  • Reserve instances on AWS Market
  • Reserve Elastic Cache Nodes
  • Have an appropriate combination of reserved, spot and on-demand statuses
  • Automation of automatic scaling options
  • Mix between S3 Standard and Glacier storage

So, this explains the process in details and it can help you while having any issue with AWS.

Do want to know more about how to reduce cloud costs? Please read the article:

How to reduce AWS costs?

13.General FAQ

How to reduce your cloud costs?

Here the best practices to reduce your cloud costs:
– Ask for AWS credits, and earn up to $ 100k;
– Utilize spot instances and save up to 90%;
– Use enhanced network;
– Buy reserved instances on the AWS market to save up to 75%;
– Move to Cloud Front and save up to 75%;
– Use a private IP
– Reduce transfer expenses with GraphQL API;
– Buy reserved elastic cache nodes to save up to 77%;
– Save your data on S3 rather than EBS;
– Apply auto-scaling for inactive resources;
– Choose Northern Virginia region;
– Upgrade to new generation families, saving up to 20%;
– Place the S3 endpoint on your VPC;
– Go for the new AWS savings plan to save up to 72%;

For a complete tutorial, please read the article How to Reduce AWS Costs.

How to reduce EC2 costs?

– Terminate Unused Instances;
– Reduce oversized resources;
– Use Reserved Instances;
– Use the AWS Marketplace
– Use SPOT Instances;
– Use Savings Plan;
– Implement auto-scaling;
– Use new generation instances;
– Choose the right region;
– Implement enhanced network.

To know more, please read the article How to Reduce AWS Costs.

How to reduce data transfer costs?

– Connect S3 endpoints to a CDN service;
– Implement GraphQL APIs;
– Use private IPs;
– Use single AZ – Availability zones;

To know more please read the article How to reduce AWS Costs.

How to reduce your S3 costs?

– Choose the correct storage model;
– Monitor your S3 API requests closely;

To know more please read the article How to reduce AWS Costs.

How to reduce your EBS costs?

– Delete unattached volumes;
– Terminate instances rather than stopping it;
– Reduce oversized EBS volumes;
– Backup data on S3 and not on EBS;
– Choose Magnetic over SSD;
– Evaluate Ephemeral Storage;

To know more please read the article How to reduce AWS Costs.


Leave a reply

Your email address will not be published.