How to Purchase, Optimize, and Manage AWS EC2 Workloads at Scale
If your cloud operations take place on Amazon Web Services (AWS), then instances are the building blocks of your computing capabilities. In this post, we take a deep dive into Amazon Elastic Compute Cloud (EC2) instances: what Amazon EC2 Instances are, how you can purchase Amazon EC2 Instances, and which ways you can optimize and manage your Amazon EC2 workloads.
What Are Amazon Web Services (AWS) EC2 Instances?
According to AWS, Amazon EC2 is “secure and resizable compute capacity for virtually any workload” allowing businesses to “access reliable, scalable infrastructure on demand.” In other words, the computing you do in AWS will be powered by some type of EC2 Instance. AWS enables users to purchase and control their EC2 computing resources within their web-based interface.
What EC2 Instance Types Are Available?
EC2 Instances launched in 2007 with one instance type. Since then, AWS has been adding new instance types and sizes. Today, there are hundreds of EC2 Instance types and sizes available, and the list is always growing.
Part of running workloads at scale involves ensuring that you’re choosing the right type of instance, not just the proper instance size, for your application. Amazon offers EC2 Instance types based on use case:
General purpose for diverse workloads, with burstable performance available
Compute optimized, which are well suited for batch processing workloads and high performance computing, gaming, and web servers
Memory optimized to process large datasets in memory
Accelerated computing, best suited for machine learning training, deep learning, graphics processing, and other intensive computing tasks
Storage optimized, designed around AWS storage options with high, sequential read/write access to very large datasets and optimized for low-latency
Within each of these categories, there are further options made up of different combinations of memory, networking capacity, storage, and CPU. The instance types that you purchase depend on the type of computing power you need. Yet regardless of what type of instance you’re using, you’ll have the same purchase options.
How Can I Purchase AWS EC2 Instances?
AWS provides four main options to purchase Amazon EC2 Instances. They are On-Demand Instances, Reserved Instances, Spot Instances, and Savings Plans. Amazon also offers the additional option of Amazon EC2 Dedicated Hosts.
This is the most basic, least complicated way to provision Amazon EC2 Instances. It’s the pay-as-you-go model. On-Demand EC2 Instance purchasing is also the most expensive way to provision resources. If you’re running an EC2 workload at scale, managing all of your instance provisioning on an On-Demand basis would get quite expensive.
Reserved Instance (RI) purchases are one of the easiest ways to start reducing cloud spends. When you buy an RI, you are “reserving” that instance for a one or three-year period. In return for that long-term commitment, AWS gives a hefty discount of up to 72% off compared to the On-Demand prices. Managed Service Providers may find RI purchasing to be the most economical option for increasing profits while adding value for their customers. If your needs change, Standard RIs can be resold on the AWS RI Marketplace or Convertible RIs can be exchanged for RIs of a comparable value but cannot be resold.
Spot Instances allow you to take advantage of Amazon’s ‘extra’ capacity. They are offered at a deep discount of up to 90% off the On-Demand EC2 prices. The catch is that you don’t actually reserve them. If someone else requests to use those instances, you’ll be disconnected after a two-minute warning.
Spot Instances are not great for customer-facing, time-sensitive use cases, or for applications that can’t be interrupted — like an e-commerce website. However, most businesses have some workloads that can be interrupted and are not time-sensitive. If you’re running any workloads that fit those requirements, Spot Instances are an option for reducing costs substantially.
AWS Savings Plans provide discounts for one or three years of committed usage, measured in dollars per hour of compute power. The EC2 Instance Savings Plan (one of three types offered) helps you purchase Amazon EC2 Instances at a significant discount of up to 72%. With this type of Savings Plan, you commit to an EC2 Instance family and region, but you have the flexibility to change instance size and operating systems. You can achieve discounts of up to 66% with a Compute Savings Plan, which allows for usage across Amazon EC2 instance types and regions, and also provides discounts for AWS Lambda and AWS Fargate.
A fifth option to purchase Amazon EC2 Instances is to use Amazon EC2 Dedicated Hosts. Dedicated Hosts allow you to use your eligible software licenses from Microsoft, Oracle, and other vendors on Amazon EC2 for added flexibility and cost effectiveness. You then are allocated a physical server fully dedicated for your use, which helps address corporate compliance requirements. Unless you have a Dedicated Host Reservation or Savings Plan, you’ll pay On-Demand. However, taking advantage of a Dedicated Host Reservation can provide a discount of up to 70% compared to On-Demand pricing.
How to Optimize Your Cloud Spend With AWS EC2 Instances
As many companies have found out the hard way, running large, heavily-trafficked applications in the cloud can become expensive. New cloud users may think this eats away at the cost savings from getting rid of the on-premises data center altogether.
The good news is that it’s possible to reduce cloud costs without compromising on performance. However, optimizing cloud spend requires understanding the different purchase models and instance types available from each cloud provider, as well as finding the right balance between high availability and cost concerns.
Running AWS workloads at scale without running up huge bills involves ensuring that you’re not paying for more capacity than you actually need. There are two primary strategies for doing so: right sizing and autoscaling.
Right sizing means provisioning the cloud resources to appropriately match your usage. This sounds much simpler than it is in practice because AWS does not provide native tooling that would make it possible to access granular enough usage data for businesses to understand their ideal instance size, instance type, and the number of instances.
Understanding which instance type to use for certain applications requires an understanding of how much compute and memory that specific application is using. Once you have that information, you can provision the optimal instance type and number of instances for your particular workload.
Right sizing also allows companies to get the most out of RI purchases. Once you determine the ideal configuration for your instances, you can purchase Reserved Instances to reduce costs further. You don’t want to make a long-term commitment before you’ve determined the efficient building-block instance size for your project.
The disadvantage of relying on right sizing as a cost management strategy is that it works best for workloads with relatively stable traffic. If you’re handling a workload with wildly varying needs, right sizing is difficult and RI purchases invariably lead to underutilization as well as the risk of failure if your traffic spikes over the amount you’ve reserved.
Autoscaling is another strategy to ensure your cloud resource provisioning matches your actual usage as closely as possible. Contrary to some expectations, AWS Auto Scaling is not an out-of-the-box feature. It’s something you have to actively manage and configure. In doing so, you can configure the rules to autoscale to specific types of instances and combine On-Demand Instances and Spot Instances. However, autoscaling doesn’t offer the cost advantages of Reserved Instances but is a better way to manage fluctuating workloads.
Right sizing and autoscaling are not an either/or proposition. Managing EC2 workloads at scale will likely involve a mixture of both strategies. This would involve identifying your “baseline” workload — or the minimum amount of resources the organization will need to have working 24 hours a day. Those resources should be provisioned using RI purchases and right sizing. Anything on top of that can be managed using autoscaling groups that specify which types of instances to add, under specific scenarios.
You can combine Reserved Instances, Spot Instances, and On-Demand Instances in a single autoscaling group that is distributed over several availability zones. This makes it possible to get the lowest cost by allowing you to determine, in advance, what percentage of scaling needs should be met with On-Demand and Spot Instances. You can also provide a prioritized list of what AWS EC2 Instance types should scale to when adding On-Demand Instances so that you can optimize performance even during traffic spikes. Part of this is done using the AWS EC2 Fleet tool, which makes it possible to integrate allocation strategies into your autoscaling systems, as well as to manage all of your capacity (RIs, On-Demand, and Spot) holistically.
Regardless of how you’re planning your EC2, ensuring that you don’t have outages if EC2 Instances fail usually means deploying to multiple availability zones within an AWS region. This allows your application to automatically failover to the second availability zone if there is any problem with the primary zone, without having traffic routed through a data center in a far-flung region, which could lead to lag time. Failover to the secondary Availability Zone can happen as a result of a failure in the first zone, or it can be part of the scaling strategy to accommodate spikes in traffic. You can use this tool to compare all of the major cloud providers’ regions and zones.
Autoscaling groups function across Availability Zones within the same region, giving you automatic control over scaling and the ability to ensure high availability while still using cost optimization strategies that look at the entire deployment.
Develop a Strategy to Purchase Amazon EC2 Instances
Relying exclusively on On-Demand Instances for EC2 workloads at scale rarely makes sense. AWS has several ways for businesses to optimize cloud costs and ensure they are provisioning the best types of resources for their workloads. Doing so, however, often requires access to analytics that are difficult to impossible to get from AWS’s native tooling.
CloudCheckr can help you understand the best instance types for your workload, help you make better decisions about how to purchase Amazon EC2 Instances, and help you develop a cost optimization strategy without compromising the need for high availability.
Schedule a one-on-one demo with us today to discover what CloudCheckr can do for your cloud cost optimization strategy.