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.
New Content: AWS Terraform, Java Programming Lab Challenges, Azure DP-900 & DP-300 Certification Exam Prep, Plus Plenty More Amazon, Google, Microsoft, and Big Data Courses
This month our Content Team continues building the catalog of courses for everyone learning about AWS, GCP, and Microsoft Azure. In addition, this month’s updates include several Java programming lab challenges and a couple of courses on big data. In total, we released five new learning...
Where Should You Be Focusing Your AWS Security Efforts?
Another day, another re:Invent session! This time I listened to Stephen Schmidt’s session, “AWS Security: Where we've been, where we're going.” Amongst covering the highlights of AWS security during 2020, a number of newly added AWS features/services were discussed, including: AWS Audit...
AWS re:Invent: 2020 Keynote Top Highlights and More
We’ve gotten through the first five days of the special all-virtual 2020 edition of AWS re:Invent. It’s always a really exciting time for practitioners in the field to see what features and services AWS has cooked up for the year ahead. This year’s conference is a marathon and not a...
WARNING: Great Cloud Content Ahead
At Cloud Academy, content is at the heart of what we do. We work with the world’s leading cloud and operations teams to develop video courses and learning paths that accelerate teams and drive digital transformation. First and foremost, we listen to our customers’ needs and we stay ahea...
Excelling in AWS, Azure, and Beyond – How Danut Prisacaru Prepares for the Future
Meet Danut Prisacaru. Danut has been a Software Architect for the past 10 years and has been involved in Software Engineering for 30 years. He’s passionate about software and learning, and jokes that coding is basically the only thing he can do well (!). We think his enthusiasm shines t...
New Content: AWS Data Analytics – Specialty Certification, Azure AI-900 Certification, Plus New Learning Paths, Courses, Labs, and More
This month our Content Team released two big certification Learning Paths: the AWS Certified Data Analytics - Speciality, and the Azure AI Fundamentals AI-900. In total, we released four new Learning Paths, 16 courses, 24 assessments, and 11 labs. New content on Cloud Academy At any ...
New Content: Azure DP-100 Certification, Alibaba Cloud Certified Associate Prep, 13 Security Labs, and Much More
This past month our Content Team served up a heaping spoonful of new and updated content. Not only did our experts release the brand new Azure DP-100 Certification Learning Path, but they also created 18 new hands-on labs — and so much more! New content on Cloud Academy At any time, y...
AWS Certification Practice Exam: What to Expect from Test Questions
If you’re building applications on the AWS cloud or looking to get started in cloud computing, certification is a way to build deep knowledge in key services unique to the AWS platform. AWS currently offers 12 certifications that cover major cloud roles including Solutions Architect, De...
Overcoming Unprecedented Business Challenges with AWS
From auto-scaling applications with high availability to video conferencing that’s used by everyone, every day — cloud technology has never been more popular or in-demand. But what does this mean for experienced cloud professionals and the challenges they face as they carve out a new p...
Constant Content: Cloud Academy’s Q3 2020 Roadmap
Hello — Andy Larkin here, VP of Content at Cloud Academy. I am pleased to release our roadmap for the next three months of 2020 — August through October. Let me walk you through the content we have planned for you and how this content can help you gain skills, get certified, and...
New Content: Alibaba, Azure AZ-303 and AZ-304, Site Reliability Engineering (SRE) Foundation, Python 3 Programming, 16 Hands-on Labs, and Much More
This month our Content Team did an amazing job at publishing and updating a ton of new content. Not only did our experts release the brand new AZ-303 and AZ-304 Certification Learning Paths, but they also created 16 new hands-on labs — and so much more! New content on Cloud Academy At...
Blog Digest: Which Certifications Should I Get?, The 12 Microsoft Azure Certifications, 6 Ways to Prevent a Data Breach, and More
This month, we were excited to announce that Cloud Academy was recognized in the G2 Summer 2020 reports! These reports highlight the top-rated solutions in the industry, as chosen by the source that matters most: customers. We're grateful to have been nominated as a High Performer in se...