AWS Open Source Blog

RHEL on Spot Instances: A New Way to Manage Costs for Your Red Hat Instances


Red Hat has been providing open source software to enterprises and developers for more than 25 years. The company is an Advanced Tier Partner of Amazon Web Services, and has offered official Red Hat images on Amazon EC2 for more than 10 years. Now there’s a new way to use Red Hat Enterprise Linux (RHEL) on EC2.

In May, 2018, the Amazon Elastic Compute Spot team announced that the Amazon Elastic Compute Cloud (Amazon EC2) Spot Fleet now supports Red Hat Enterprise Linux (RHEL) instances. Customers using Red Hat subscriptions can now take advantage of Spot Instances (unused EC2 instances available for less than the on-demand instance price). This can be a cost-effective choice if you are able to be flexible about when your applications run, and if your applications can be interrupted. With Spot Fleet Requests, you can create more sophisticated launch configurations of a collection (or fleet) of Spot instances.

This is a byol (bring your own license) offering, so let’s first take a deeper dive into what Red Hat Enterprise Linux options you can use with EC2 Spot instances. Once we have established the steps for using RHEL instances, we will add the EC2 Spot Hibernation Agent.

Red Hat contributes to communities that are changing the landscape of technology, from the operating system and developer toolchain to middleware, the desktop, and the cloud. Red Hat does not provide licenses for this community-produced software; instead, it uses a subscription model for access to compiled binaries and support for images.

If you are already using Red Hat on AWS, you know that there are two subscription models available: pay-as-you-go, and byos (bring your own subscription). However, pay-as-you-go images are not eligible to be used with EC2 spot instances.

The Red Hat AMIs that can be used with spot instances are those that customers import for themselves, or build on the gold images provided through Red Hat’s Cloud Access Program (CAP) for use with annual subscriptions obtained directly from Red Hat. If you have a Red Hat login and Red Hat Enterprise Linux Server subscription, you already have access to these gold images, and can download Red Hat tested and certified enterprise software without additional license fees or upgrade costs. Alternatively, you can upload your own images using a process such as the VM Import/Export service to import virtual machine images from your own virtualized instances.

Using the Red Hat Gold Images

Using the gold images requires some advance preparation. You must first enroll in Red Hat’s Cloud Access program, which can take up to 24 hours. This gives you private access to the byos Red Hat Enterprise Linux AMIs necessary for use with EC2 Spot Instances. Red Hat provides this access by sharing the AMI directly from the Red Hat publication account to your registered AWS account.

Once you have access to the images, you can begin using Spot Instances with your RHEL-based solutions. Red Hat Enterprise Linux and the products provided through CAP are fully supported when using subscriptions purchased directly from Red Hat; using spot instances doesn’t change anything with respect to the support model.

You can locate these private images in the AMIs section of the EC2 Console. Narrow your search to the images shared to the account for Cloud Access by restricting your output to private images shared from the official account to which Red Hat publishes AMIs.

Making a Spot Request

At the Red Hat Summit 2018, Burr Sutter, Director of Developer Experience at Red Hat, led a session on aligning workloads across hybrid environments, including increasing capacity across Amazon EC2. He explained how, using Red Hat Enterprise Linux with EC2 Spot Instances, customers can consistently take advantage of the lowest prices available.

Request spot instances dialog box

Adding Amazon EC2 Spot Instances to the options for AWS customers who run RHEL on EC2 increases the number of launch-time configuration options. You now have the option to use the Amazon EC2 Fleet to simplify deployment of Red Hat Enterprise Linux across different EC2 instance types and Availability Zones, while spreading workloads across standard instance prices, EC2 Spot Instance prices, and Reserved Instance (RI) prices. Jeff Barr’s post EC2 Fleet – Manage Thousands of On-Demand and Spot Instances with One Request gives more details on using EC2 Fleet.

Red Hat provides gold images for: Red Hat Enterprise Linux, Red Hat Atomic Host, Red Hat Gluster Storage, and Red Hat JBoss Enterprise Application Platform. These gold images can be used to create spot launch configurations, fleet requests, and simple spot instance requests in support of various platform deployment models. The Cloud Access Program makes it even easier to migrate the use of Red Hat subscriptions to Amazon EC2.

Red Hat Cloud Access Program - register image

For products not provided as a gold image, such as Red Hat OpenShift, Red Hat Satellite, Red Hat Enterprise Linux for SAP, or your own bespoke applications built on Red Hat technology, first start with a Red Hat Enterprise Linux AMI, and then install the desired Red Hat product or add-on.

When you’re building the spot instance request, there is no drop-down option for RHEL; you will need to select it from the private images shared to the AWS account. Choose the AMI from the AMI chooser by searching for the version you intend to use. In the example pictured below, you can see a search for AMIs shared to the account. This search was built with the conventions explained in How to list the latest available RHEL images on Amazon Web Services (a Red Hat Knowledgebase Article).

locating your RHEL AMI

If you want to start an image on the spot fleet, instead of looking to the EC2 console for your AMI ID, use Red Hat’s gold images shared to your account through the Red Hat Cloud Access Program (CAP). With this extended support for RHEL, it’s easier than ever to migrate your current subscriptions for use on Amazon EC2 today.

The Amazon EC2 Spot Instance team provides an open source agent for hibernation that makes all the necessary changes to ensure that the instance fully supports hibernation requirements. They also provide a large number of examples, scripts, and templates available in the ec2-spot-labs repository so you can get started today with exploring how to incorporate RHEL and EC2 spot into your own Amazon EC2 infrastructure!

David Duncan

David Duncan

David is a Principal Solutions Architect at Amazon Web Services. He works to ensure stable, secure, and consistent delivery for open source platform partners on Amazon EC2.