We at SOFTSWISS have been using Amazon Web Services for a couple of years. At the beginning of our journey, a minimal number of services was used. Things have changed after we decided to move our Data Science related infrastructure to the cloud, mainly because of dissatisfaction with the availability level of on-premise open-source solutions we used.
AWS provides outstanding availability, scalability, and fault-tolerance levels, usually out of the box, reducing the maintenance level needed. At the same time, costs might be much higher, which can be a huge problem, especially at scale. Building cost-effective solutions on AWS can be tricky, but we will consider some general savings options which apply to almost any organisation.
The article assumes you have basic knowledge of AWS and aims to motivate and encourage you to take the first steps in AWS savings.
Save on Computing
In most cases, the cost of the Amazon Elastic Compute Cloud Service (EC2) is one of the bill's most significant. There are some considerations about reducing it:
Proper purchasing options
It is worth thinking twice before choosing the EC2 instance purchasing option, especially if it is an on-demand instance. Ask yourself the following questions to determine the most cost-efficient option:
- Can that instance be interrupted without affecting application logic? Is it used for batch or background processing? If so, it is worth considering using EC2 spot instances – they are up to 90% cheaper.
- Will you use this instance for at least 1 year? Can it be reserved? Is it possible to pay upfront? AWS provides plenty of reservation options which let you receive a discount up to 72% using Reserved Instances (RI).
Commitment to resource usage
If a reservation is not the option, Saving Plans can be the rescue option. Sometimes it can be much more flexible than RI and could save up to 72% as well.
Serverless architectures are easier to manage regarding correct resource allocation. Due to its pay-per-value pricing model and scale based on demand, serverless effectively reduces the capacity planning effort and makes the total price less in most cases.
Saving plans are also applicable for Serverless solutions, and it is the most powerful combination in computing cost-efficiency.
Save on Storage
AWS Simple Storage Service (S3) is the most popular object storage solution inside the AWS Cloud and, probably, all over the world. Potential savings here may come mainly from using proper storage classes and setting up appropriate lifecycle policies.
- Intelligent-tiering. Automatically reduces storage costs on a granular object level by automatically moving data to the most cost-effective access tier based on access frequency. Supports all storage classes below.
- Infrequent Access (IA). For data that is accessed less frequently but requires rapid access when needed. Saves up to 40% compared to Standard.
- One Zone IA (OZ IA). Up to 20% cheaper than IA.
- Glacier. For the lowest-cost storage for long-lived data that is rarely accessed and requires retrieval in milliseconds. Up to 68% less compared to IA.
- Deep Archive. For long-term retention and digital preservation of data that may be accessed once or twice a year. 4x times cheaper than Glacier.
To make object storing cost-efficient through its life cycle, Amazon S3 Lifecycle can be used. With its simple rules, S3 moves an object (or objects group) across proper storage types, even sets up expiration rules, and deletes what will not be used.
Also, one of the most common mistakes is accessing an S3 bucket from AWS VPC via Internet Gateway using a public endpoint. Transferring terabytes of data via Internet Gateway can be very unpleasant for the budget; use gateway VPC endpoints instead.
Saving options for AWS Elastic File System (EFS) are similar to S3. Choosing the proper storage type (Standard, Standard-IA, One Zone, One Zone-IA) is the key to optimising the price. The philosophy behind storage types is pretty similar to S3 storage classes, and File Lifecycle Policies can be used for cost reduction as well.
AWS Elastic Block Store (EBS) provides block-level storage volumes for use with EC2 instances. The most common scenario is using it as an RDS storage, but not only. It’s essential to choose the right volume type for the specific workload.
Other ways to reduce costs:
- deleting unattached EBS from EC2, if they are not needed
- constant monitoring and downsizing underutilised volumes
- removing old snapshots, which are no longer needed; managing snapshots with Data Lifecycle Manager
Save on Data Transfer
Data transfer costs may be a significant part of the AWS bill, especially when a business operates tens of terabytes of data monthly. Unfortunately, not much could be done without changing the architecture itself. That's why it might become a trap for startups – it stays unnoticed while the traffic cost is comparably low and may seem inevitable at scale. It is worth considering:
- keeping the data within the same Availability Zone (AZ). Placing only the data/computing instances necessary for disaster recovery is worth considering
- keeping the data within the same region (unless speaking about protection against a natural disaster, such as an earthquake, that may affect whether a whole region is needed)
- avoiding accessing AWS resources via the public internet. Using Gateway Endpoints or Private Links is much more efficient
The resource usage pricing model in the cloud is entirely different from bare-metal solutions and may even look confusing at first. Attempts to migrate ‘as is’ are will highly likely ruin the budget and may lead to great disappointment. But even if everything is designed in a cloud-optimised way, resource usage monitoring is much more important than traditional DC usage.
Cost reduction in the cloud is an ongoing process rather than a one-time action. It is worth investing time in defining budgets, setting up cost monitoring, and reviewing AWS resource usage. After all, AWS constantly releases new, more cost-efficient services, instance types, and even hardware which can positively impact the budget.
This article covers the basic and the most obvious scenarios of saving data, but once you start, you will learn how to do it more and more efficiently, step by step.