Blog

AWS Cost Optimization Best Practices & Strategies

Bryan Adams

Founder & CEO

Why AWS for Cost Optimization?

Amazon Web Services (AWS) is the biggest provider and a formidable cloud-computing resource. While its sheer size and computing resources are most useful in class and the support is spot on, the pricing is one of the major user learning reasons for AWS’ big achievement. AWS has an amazing pricing policy that all users find remarkable. It publishes documents on how to optimize server costs and utilize the resources efficiently to make the most of what you use and pay for. When it comes to AWS cloud, the conception attached to its pricing is simple. At the end of every month, you pay only for what you use. You can rise or stop using a product at any point in time
Let’s take a look at the AWS cost optimization ways on Amazon Web Services.
Let’s take a look at the AWS cost optimization ways on Amazon Web Services.
You Need to Right size Instances

Right-sizing is an efficient way to control cloud costs. It includes analyzing instance performance and user needs and directors and then turning off idle instances and right-sizing instances.Read More ⟶

Right Size Using Performance Data

Identify instances with a maximum CPU usage and memory usage of less than 40% over four weeks. These are the instances that you will need to right-size to decrease costs.

Right Size Your Database Instances

Storage and instance type are decoupled. When you scale your database instance up or down, your storage size remains the same and is not affected by the change. You can separately modify your Amazon RDS DB instance to increase the allocated storage space or improve the performance by changing the storage type.

Right Size by Selecting the Right Instance Family

You can right-size an instance by migrating to a different model within the same instance family or by migrating to another instance family.

Right Size by Turning Off Idle Instances

The easiest way to reduce operational costs is to turn off instances that are no longer being used. If you find instances that have been idle for more than two weeks, it’s safe to stop or even terminate them.

Tools for Right-Sizing
  • Cost Explorer – AWS Cost Explorer is a tool that helps visualize costs and usage data in an intuitive and interactive interface.
  • AWS Instance Scheduler – It reduces the cost by holding resources that are not in use and starting resources.
  • Amazon Cloud Watch – It helps to set the alarms from specified recourses.
  • Cost and Usage Report – AWS Cost Usage and Report tool present an hourly, daily, or monthly comprehensive report of your AWS cost, usage, services pricing, and other data.
  • AWS Cloud Trail – Cloud Trail allows you to monitor, manage and log reports from your Amazon Web Service on the go. This tool keeps you alerted when there is an unusual surge in activities that may increase costs and lets you act accordingly
Always Delete Zombie Resources
One of the biggest drains on your AWS bill is continuing to run unused resources that are billed continuously, not per usage.
 
Eliminate Zombie Assets
Zombie resources are foundation parts that are running in your cloud climate however not being utilized for any reason. Zombie resources come in many structures. For instance, they could be EC2 once utilized for a specific reason yet are as of now not being used and have not been wound down. Zombie EC2 cases additionally can happen when examples come up short during the dispatch interaction or in light of blunders in script that neglect to deprovision occurrences.
 
Zombie assets can also come in the form of idle Elastic Load Balancers (ELB) that aren’t being used effectively or an idle Relational Database Service (RDS) instance. No matter the cause, AWS will charge for them as long as these assets are in a running state.
 
They must be isolated, evaluated, and immediately terminated if deemed nonessential. Take a snap-shot, or point-in-time copy, of the asset before terminating or stopping it to ensure you can recover it if the asset is needed again.
 
One customer had a nightly process to help its engineering velocity — loading an anonymized production database into RDS to use for testing and verification in a safe environment. The process worked well and saved a lot of time for engineers. However, while the automation was good at spinning up new environments, the customer never made a plan 
 
Better to Purchase Reserved Instances
Purchasing Reserved Instances is an easy way to reduce AWS costs.
reserved Instances provide you with a significant discount (up to 72%) compared to On-Demand Instance pricing. In addition, when Reserved Instances are assigned to a specific Availability Zone, they provide a capacity reservation, giving you additional confidence in your ability to launch instances when you need them.
 
Go for Instance Scheduling
Ideally, instances should only be started when actually used, but this may not be practical for many purposes. A common example is EC2 instances used for ongoing development and testing.
This Solutions Implementation helps you control your AWS resource cost by configuring start and stop schedules for their Amazon Elastic Compute Cloud (Amazon EC2) and Amazon Relational Database Service (Amazon RDS) instances.
It also helps reduce operational costs by stopping resources that are not in use and starting resources when capacity is needed. For example, a company can use AWS Instance Scheduler in a production environment to automatically stop instances outside of business hours every day. If you leave all of your instances running at full utilization, this solution can result in reducing the instance utilization, which will reduce overall cost based on the schedules configured.
 
Scheduling On/Off Times
It’s worth scheduling on/off for non-production instances used for development, staging, testing, and QA as it can save up to 65% of running these instances.
Amazon EC2 can create the following types of events for your instances, where the event occurs at a scheduled time:
  • Instance stop: At the scheduled time, the instance is stopped. When you start it again, it’s migrated to a new host. Applies only to instances backed by Amazon EBS.
  • Instance retirement: At the scheduled time, the instance is stopped if it is backed by Amazon EBS, or terminated if it is backed by instance store.
  • Instance reboot: At the scheduled time, the instance is rebooted.
  • System reboot: At the scheduled time, the host for the instance is rebooted.
System maintenance: At the scheduled time, the instance might be temporarily affected by network maintenance or power maintenance.
 
Data Before Storage
Compressing data reduces your storage requirements. Subsequently, reducing the cost of storage.
 
  • Partition your data: Partitioning divides your table into parts and keeps the related data together based on column values such as date, country, region, etc. Partitions act as virtual columns. You define them at table creation, and they can help reduce the amount of data scanned per query, thereby improving performance. You can restrict the amount of data scanned by a query by specifying filters based on the partition.
  • Bucket your data – Another way to partition your data is to bucket the data within a single partition. With bucketing, you can specify one or more columns containing rows that you want to group together, and put those rows into multiple buckets. This allows you to query only the bucket that you need to read when the bucketed columns value is specified, which can dramatically reduce the number of rows of data to read.
  • Use Compression – Compressing your data can speed up your queries significantly, as long as the files are either of an optimal size (see the next section), or the files are split table. The smaller data sizes reduce network traffic from Amazon S3 to Athena.
  • Optimize file sizes – Queries run more efficiently when reading data can be parallelized and when blocks of data can be read sequentially. Ensuring that your file formats are split table helps with parallelism regardless of how large your files may be.
Always Identify and then Delete Orphaned Snapshots
Unless you are actually thinking of using orphaned snapshots for creating future EBS volumes, you should delete them as part of your cloud housekeeping.
After you no longer need an Amazon EBS snapshot of a volume, you can delete it. Deleting a snapshot has no effect on the volume. Deleting a volume has no effect on the snapshots made from it.
  • Incremental snapshot deletion – If you make periodic snapshots of a volume, the snapshots are incremental. This means that only the blocks on the device that have changed after your most recent snapshot are saved in the new snapshot. Even though snapshots are saved incrementally, the snapshot deletion process is designed so that you need to retain only the most recent snapshot in order to create volumes.
  • Delete a multi-volume snapshot – To delete multi-volume snapshots, retrieve all of the snapshots for your multi-volume snapshot set using the tag you applied to the set when you created the snapshots. Then, delete the snapshots individually.
Check Payment Options
Amazon has three options for payments – ‘All Upfront’, ‘Partial Upfront’ and ‘Pay Over Time’: The earlier you pay and the more you pay upfront, the biggest the discount will be
 
Clean up EBS Volumes
EBS (Elastic Block Store) volumes provide persistent block storage volumes for use with Amazon EC2 (Elastic Compute Cloud) instances. Make sure you set up to automatically delete unattached EBS volumes upon decommissioning each instance.
 
Use Auto Scaling
You can adjust the auto scale whenever you want and set thresholds for performance triggers.
Auto scaling  monitors your cloud resources and adjusts them for optimum performance. When one service requires more computing resources, it can ‘borrow’ from idle instances. This option automatically scales down resource provision when demand subsides. Auto scaling also lets you set thresholds for performance triggers so that you can schedule for expected changes in resource demand
 
Manage Data Transfer Costs
Design your infrastructure and framework so that data transfers across AWS regions or AZs are optimized.
There is always a cost associated with transferring your data to the cloud. Whether it’s a transfer between the internet and AWS, between different storage services, or moving to different regions of availability, you will incur a cost. You should configure your infrastructure to limit data transfer between regions.