When first getting started with the AWS cloud, people tend to make common mistakes. Some are related to security, like allowing open access to infrastructure or giving a wide range of permissions to every team member, instead of applying the principle of least privilege. Others arise when trying to choose the right service for the job, potentially causing the environment to work in a suboptimal manner. But where most people go wrong is when controlling the cost.
AWS is not inexpensive, even when utilized properly, so when you don’t have an experienced operations team to make sure that your cloud implementation is done the right way, your monthly spending can get out of hand. Unfortunately, there are many companies out there, especially smaller startups, which have to rely on their developers, or even managers, to handle their work in the cloud.
In this article, we will help you optimize your AWS costs by examining one of the common cost producers, an EC2 instance. We’ll also introduce you to N2WS Backup & Recovery, and provide a how-to guide for a new feature called N2WS Resource Control, which we hope you’ll find useful.
Amazon EC2 Instance Cost Control
Let’s take a look at the costs that EC2 instances actually produce.
Compute Power
First off, you pay for the compute power. For example, a t3.medium—not a very powerful instance—will cost you $0.0418 per running hour. So for an entire month of usage, this will amount to around $30. This isn’t too expensive, but it’s only the cost for a single running instance, and many environments run dozens, or even hundreds, of instances to process their workloads.
Some larger instances, like the commonly used compute-optimized c5.2xlarge, will cost around $250 per month. But there are also other very powerful (and very expensive) instances. An r5a.12xlarge, for example, will cost you almost $2,000 for a full month of usage.
Amazon EBS Volumes
The other cost that comes with EC2 instances is that of Amazon EBS volumes. But for a decently sized 100GB Amazon EBS volume (gp2 standard type), you’ll only spend $10 per month. And while there are more expensive options with specialized provisioned IOPS volumes (or you’ll simply need terabytes and terabytes of disk space), on average, compute power is what produces the majority of the total cost.
Data Transfer
Another thing to consider is the cost of data transfer. This is the cost associated with any egress of data; and the “further” away the data is sent, the more it costs. Data transfer within your Availability Zone (AZ) is only priced at $0.01 per GB, but if you send it to another AZ within your region, the price goes up to $0.02 per GB. For full data transfer out (data leaving the AWS cloud), each gigabyte will cost you $0.09.
So, What’s the Solution?
With that in mind, another thing to consider is that more often than not, an instance is not used 100% of the time. More likely, it will be utilized during office hours or at specific times when a certain job is running. The rest of the time, the instance will be idle—producing cost while doing nothing for you. Even in smaller cloud environments with only a few instances running (let alone larger ones), this can have a significant effect on your AWS monthly bill. So, what’s the solution?
Well to start, you can look into Amazon EC2 Reserved Instances (RI) or Spot Instances, which both allow for great savings on compute resources when compared to on-demand. You can get a discount of up to 75% when purchasing RI for a 3-year period, but they also give you a capacity reservation. Spot Instances are a spare compute capacity, offering even steeper discounts, so if your workloads aren’t impacted by interruption, this is something to look into.
Introducing N2WS Backup & Recovery
Another very simple solution to drastically reduce spending is to stop instances when they are not utilized. With that said, let’s introduce N2WS Backup & Recovery, a cloud-native backup tool designed specifically for AWS. Used primarily for simple backups and restores, this product enables you to have your instances up and running in under 30 seconds—whenever needed. This makes it a perfect tool for use cases like disaster recovery, especially since you can bring up your instances in both another Region which is unaffected and in a completely different AWS account.
This tool has been around for a while, and has evolved quite a bit, with the recent update including features like Archive Snapshots to Amazon S3 (allowing you to save up to 98%), VPC Capture & Clone, and others.
In this article, we are focusing on recent updates, which offers the ability to schedule the starting and stopping of your EC2 instances (and Amazon RDS instances as well). This feature, called N2WS Resource Control, is a great option, as it allows you to avoid manually scripting this entire process yourself. So, let’s explore how you can use this new feature, step by step.
N2WS Resource Control: A How-To Guide
Start by logging into your N2WS Backup & Recovery console.
If this is your first time logging in, you might have to give it a few moments to establish the necessary connection.
After N2WS Backup & Recovery initializes, go to the Resource Control tab on the top bar.
First off, you want to define some groups, so that you will have logical organization for multiple instances (for example, belonging to the same workload type, etc). Click on ”New Group.”
If you are already using this tool, then you have the basic setup in place, but new customers will receive the following message:
If this is the case, complete the process by clicking on “define accounts,” after which you will be redirected to the Accounts tab. Click on “Add New Account” and provide the necessary information.
After setting up a new account, go back to the Resource Control tab and proceed to define your group. When your group is ready, you can start setting up your desired scheduling.
First, select the instances from your resources pool that will be part of this group by opening “Resource Targets” under the Configure tab.
Here you can add both your Amazon EC2 and Amazon RDS instances to be controlled by your scheduled actions.
Click on “Add Instances” and select the desired instances from the list of your available resources within the desired Region.
After you have added all the instances you want, go back to the groups to start creating schedules.
As you can see in the screenshot below, you can create multiple schedules and adjust the start and stop time of your instances to suit your various needs. This allows you to create the fine-grained control that your environment requires—and all that via the user-friendly interface.
Another very useful feature you can utilize here is to have your entire group of instances turned on or off with one click. Whether you need your instances up and running quickly to process a task, or you want them all stopped early, simply click “Turn On ASAP” or “Turn Off ASAP.”
If you look at your AWS console, you will see that almost immediately, your instances will start changing their state.
N2WS Backup & Recovery: Other Features to Consider
Recent updates also brought with it some other improvements. First off, N2WS Backup & Recovery now supports the newly launched AWS Region in Stockholm, Sweden. The AWS GovCloud Regions are fully supported now as well.
If you relied on N2WS Backup & Recovery APIs, the range has also been expanded. Now you can easily configure alerts and recovery targets, and all APIs are fully supported via the CLI. And, there are improvements to features like Archive Snapshots to S3, allowing for even greater savings.
Summary
When running a cloud infrastructure, it is crucial to be mindful about your resources, as an improperly utilized AWS environment can produce some significant costs. As you have seen, by simply shutting down your idle Amazon EC2 instances, you can benefit from great savings on your compute resources, which most likely represent the majority of your overall cloud spending.
To avoid having to create manual scripts and custom solutions, N2WS Backup & Recovery came up with a feature, N2WS Resource Control, that allows you to easily schedule starting and stopping of your grouped instances. And with a growing list of other useful features, like allowing you to quickly restore your infrastructure or store snapshots directly in Amazon S3, it is a product you should definitely consider for your AWS environment.