Moving to the cloud offers businesses many advantages over managing their own infrastructure. Cost savings is the primary benefit for companies that make the leap to the cloud. However, there are still many opportunities for cutting costs even after the initial migration. If unchecked, these missed opportunities could silently be costing your business money that is better spent elsewhere. Periodically reviewing your cloud usage is a great way to spot these opportunities for additional savings. In this post, we’ll show you three ways to cut your EC2 costs on Amazon Web Services (AWS) by exploring cost optimizing techniques available for their core compute service: Elastic Compute Cloud (EC2).
What is EC2?
Elastic Compute Cloud (EC2) provides infrastructure as a service (IaaS). It allows users to launch virtual machines known as “instances” that can be used to perform any kind of function that your business requires without worrying about servers, networking, and other hardware. With EC2, you can create, launch, and terminate these instances as needed and only pay for what you use. You have full control over the geographical location where the instances are provisioned, and you can take advantage of resiliency by deploying into different availability zones within each of the regions.
Many AWS users are familiar with the free tier, which allows you to use several services for free with some restrictions in your first year. In EC2, the popular t2.micro instance type is eligible for free tier use. But what about after your free tier eligibility runs out or when you need more powerful instances? EC2 provides several pricing models, each with their own sweet spots. Let’s take a look.
A popular choice in AWS, on-demand pricing provides the most flexibility in launching instances as you please. This model is best suited for unpredictable workloads that can’t be interrupted, and for early development and prototyping. On-demand instances are charged by the hour, rounded up to the nearest hour. This implies that if you terminate and launch an instance multiple times in a single hour, you will be billed for multiple hours. You also pay the price for the freedom of launching instances without any commitment. On-demand pricing is the most expensive option for EC2 in most situations.
When you have established a steady-state or when you know your EC2 usage requirements in advance, you should consider using reserved instances. Depending on the configuration, reserved instances can save you up to 75% versus on-demand pricing. This pricing model locks you in for a one- or three-year contract with payment upfront, partially upfront, or no upfront. If you have predictable recurring demand patterns, you can make use of scheduled reserved instances, which reserve capacity only when you need it. The contracts come in standard and convertible flavors depending on how flexible you need to be for switching instance families, operating systems, etc.
If you think that you might end up having buyer’s remorse after locking in a reserved instance, there are a few things that you should know:
- You are allowed to change availability zone, instance size (for Linux OSes), and networking type for all reserved instance contracts.
- You can sell your unused standard reserved instance contracts if you no longer need them. The Reserved Instance Marketplace is provided by AWS for connecting buyers and sellers for third-party reserved instance contracts. The contracts will often be for a shorter duration than the standard one- or three-year contract and for a lower price.
- You can continue to use your reserved instance while it is for sale in the marketplace. If a reserved instance contract sells while in use, you will be charged at the on-demand price.
Spot instances offer the potential of saving 90% over on-demand instances but come with some unique caveats. The price of spot instances is market-driven. This means that the demand for instances within AWS regions and availability zones determine the price. You submit bids for instances and as long as the bid is above the current spot price, your bid will be fulfilled. However, market conditions can change in an instant. Your instance can be terminated, potentially without any warning, once your bid is surpassed by the market price. If this is the case, you won’t be charged for the partial hour in which your instance was terminated due to increases in market price. The image below illustrates the fluctuations in spot prices across different availability zones in the us-west-2 region:
There are a few more ways to bid on instances instead of the single instance bid described. You can bid on groups of spot instances using spot fleets. Spot fleet requests provide a convenient way to submit multiple spot instance bids at once. Your spot fleet request may be fully, partially, or not fulfilled at all depending on the market conditions and your spot fleet request.
You can also specify an allocation strategy as part of your spot fleet request. Two allocation strategies are currently supported: lowest price and diversified. Lowest price will fulfill the request in a way that minimizes your costs. Diversified adds more concern to your application availability. It will attempt to balance instances across requested instance types and availability zones instead of only considering cost.
Spot blocks are another way to request spot instances. Spot blocks allow you to make reservations of a fixed duration between one and six hours regardless of how the spot market price fluctuates after your request is fulfilled. This provides a balance between cost savings using the spot market and ensuring your instance will not be terminated for a set amount of time. With spot blocks, you can expect to save around 30% to 45% compared to on-demand pricing. But beware. While rare, it is possible for spot block instances to be terminated in certain circumstances. If there is a large enough increase in demand for the instance type, AWS can terminate the instance but would provide a two-minute warning.
You may be able to tolerate unprompted termination in many situations. You can also make use of strategies to avoid having your instances terminated. Our new Cloud Academy lab Using EC2 Spot Instances teaches you the ins and outs of using spot instances hands-on. As the lab demonstrates, spot pricing can be combined with the next cost saving opportunity: auto-scaling.
Scaling to meet demand
When a new service gets developed, the load profile for it is unknown — this is a common scenario. To develop the service quickly, a couple of EC2 instances are spun up to provide high availability for the service. Before long, the developers get busier and the service becomes more popular.
To handle the load, larger instances are used or more instances get added. From a cost perspective, this is not optimal because the load is very likely to fluctuate over different days of the week and different hours of the day. You could be paying to service peak load 24/7 when in reality your peak loads happen at various intervals—and not 24/7. Avoiding this kind of operational inefficiency is probably one reason why you moved to the cloud in the first place.
AWS provides auto-scaling to meet the dynamic demands of your applications with minimal operational overhead. When there is a large load, auto-scaling will launch more instances and vice versa for when load decreases. This can lead to significant savings when using on-demand or spot instances. This type of auto-scaling is called dynamic scaling.
Here is another scenario. Let’s say that there is a delay between when the change in load is detected, when the instance launches, and when the instance is available for use. This can be unsatisfactory for handling spikes in load. If you want to be more proactive but still save on costs, you can use scheduled scaling. With scheduled scaling, you can choose the time and days that you would like to add more instances so you are ready but also not paying for off-peak hours.
There is no additional charge to use auto-scaling. Charges are simply for the underlying instance hours according to the pricing model that is in effect. Each of the previously described pricing models are available here.
If your company has enterprise licenses, for example, Windows, SQL Servers, or Red Hat Enterprise Linux, you can bring them to the AWS cloud and free yourself from the hardware and maintenance costs by using EC2 Dedicated Hosts.
Dedicated Hosts provide you with a physical server that is not shared with other cloud customers. This is not to be confused with Dedicated Instances, which offer the same benefit. In addition to isolation from other customers, Dedicated Hosts provide more control over how instances are placed on the host. For example, if you restart a Dedicated Instance, it could end up on a different host, which would not play well with a license attached to a specific host.
Dedicated Hosts can be charged using on-demand or reserved pricing. If you only need the security of being isolated from other customers, you can use Dedicated Instances that can be charged using all three pricing models discussed earlier, giving you more opportunities to save. AWS provides tables that make it easy for you to compare Dedicated Instance pricing options and Dedicated Host pricing options.
For Microsoft users, in particular, you can consider additional cost saving opportunities. If you prefer to have AWS handle the Microsoft licenses for EC2 instances, that’s no problem. But keep in mind that the same instance running Windows will cost twice as much as if the instance were running Linux, and even more if running SQL Server on top. With SQL Server 2017 running on Linux and Microsoft .NET Core allowing applications to run on Linux, now is as good a time as any to consider the question of operating system dependence and how it impacts your bottom line.
Remember, cost savings do not end after cloud migration. There are many opportunities to optimize costs throughout the lifetime of your cloud operations. If you’re looking to reduce your current EC2 bill, try these three options:
- Consider your pricing model options. Spot instances offer up to 90% savings over on-demand while reserved instances offer up to 75% savings.
- Make use of auto-scaling to automatically allocate just enough EC2 instances.
- Think creatively about your options for cutting back on enterprise license costs that are included in your EC2 bill.
These options all play well with one another and can work together to give you the most value in the cloud.
To get started with implementing savings on EC2, our hands-on labs for spot instances and auto-scaling will guide you every step of the way.
- Using EC2 Spot Instances will show you the ins and outs of using EC2 spot instances in AWS. We’ll cover everything from a one-time spot instance request to strategies for dealing with unprompted instance termination and maintaining auto scaling spot fleets.
- For auto-scaling, start with our hands-on lab Working with Amazon EC2 Auto Scaling Groups to learn the basics of auto-scaling in AWS, then move on to Creating Your First Auto Scaling Group to scale the Amazon EC2 capacity up or down automatically according to the defined conditions.
Next, stay tuned for our upcoming Cloud Academy course devoted entirely to optimizing your costs in the cloud.
Top 5 AWS Salary Report Findings
At the speed the cloud tech space is developing, it can be hard to keep track of everything that’s happening within the AWS ecosystem. Advances in technology prompt smarter functionality and innovative new products, which in turn give rise to new job roles that have a ripple effect on t...
New on Cloud Academy: Red Hat, Agile, OWASP Labs, Amazon SageMaker Lab, Linux Command Line Lab, SQL, Git Labs, Scrum Master, Azure Architects Lab, and Much More
Happy New Year! We hope you're ready to kick your training in overdrive in 2020 because we have a ton of new content for you. Not only do we have a bunch of new courses, hands-on labs, and lab challenges on AWS, Azure, and Google Cloud, but we also have three new courses on Red Hat, th...
Cloud Academy’s Blog Digest: Azure Best Practices, 6 Reasons You Should Get AWS Certified, Google Cloud Certification Prep, and more
Happy Holidays from Cloud Academy We hope you have a wonderful holiday season filled with family, friends, and plenty of food. Here at Cloud Academy, we are thankful for our amazing customer like you. Since this time of year can be stressful, we’re sharing a few of our latest article...
Google Cloud Platform Certification: Preparation and Prerequisites
Google Cloud Platform (GCP) has evolved from being a niche player to a serious competitor to Amazon Web Services and Microsoft Azure. In 2019, research firm Gartner placed Google in the Leaders quadrant in its Magic Quadrant for Cloud Infrastructure as a Service for the second consecuti...
New Lab Challenges: Push Your Skills to the Next Level
Build hands-on experience using real accounts on AWS, Azure, Google Cloud Platform, and more Meaningful cloud skills require more than book knowledge. Hands-on experience is required to translate knowledge into real-world results. We see this time and time again in studies about how pe...
New on Cloud Academy: AWS Solution Architect Lab Challenge, Azure Hands-on Labs, Foundation Certificate in Cyber Security, and Much More
Now that Thanksgiving is over and the craziness of Black Friday has died down, it's now time for the busiest season of the year. Whether you're a last-minute shopper or you already have your shopping done, the holidays bring so much more excitement than any other time of year. Since our...
Understanding Enterprise Cloud Migration
What is enterprise cloud migration? Cloud migration is about moving your data, applications, and even infrastructure from your on-premises computers or infrastructure to a virtual pool of on-demand, shared resources that offer compute, storage, and network services at scale. Why d...
6 Reasons Why You Should Get an AWS Certification This Year
In the past decade, the rise of cloud computing has been undeniable. Businesses of all sizes are moving their infrastructure and applications to the cloud. This is partly because the cloud allows businesses and their employees to access important information from just about anywhere. ...
AWS Regions and Availability Zones: The Simplest Explanation You Will Ever Find Around
The basics of AWS Regions and Availability Zones We’re going to treat this article as a sort of AWS 101 — it’ll be a quick primer on AWS Regions and Availability Zones that will be useful for understanding the basics of how AWS infrastructure is organized. We’ll define each section,...
Application Load Balancer vs. Classic Load Balancer
What is an Elastic Load Balancer? This post covers basics of what an Elastic Load Balancer is, and two of its examples: Application Load Balancers and Classic Load Balancers. For additional information — including a comparison that explains Network Load Balancers — check out our post o...
Advantages and Disadvantages of Microservices Architecture
What are microservices? Let's start our discussion by setting a foundation of what microservices are. Microservices are a way of breaking large software projects into loosely coupled modules, which communicate with each other through simple Application Programming Interfaces (APIs). ...
Kubernetes Services: AWS vs. Azure vs. Google Cloud
Kubernetes is a popular open-source container orchestration platform that allows us to deploy and manage multi-container applications at scale. Businesses are rapidly adopting this revolutionary technology to modernize their applications. Cloud service providers — such as Amazon Web Ser...