Chapter 3. Deploying a RHEL image as an EC2 instance on AWS


To use a Red Hat Enterprise Linux (RHEL) image on Amazon Web Services (AWS), you need to convert the RHEL image to an AWS-compatible format, Amazon Machine Image (AMI) and for customization, use either RHEL image builder or manual configuration. From an AMI, you can launch an Elastic Cloud Compute (EC2) instance.

3.1. Available RHEL image types for public cloud

To deploy your RHEL virtual machine VM on a certified cloud service provider (CCSP), you can use several options. The following table lists the available image types, subscriptions, considerations, and sample scenarios for the image types.

Note

To deploy customized ISO images, you can use RHEL image builder. With RHEL image builder, you can create, upload, and deploy these custom images specific to your chosen CCSP.

Expand
Table 3.1. Image options
Image typesSubscriptionsConsiderationsSample scenario

Deploy a Red Hat gold image

Use your existing Red Hat subscriptions

The subscriptions include the Red Hat product cost and support for Cloud Access images, while you pay the CCSP for all other instance costs

Select a Red Hat gold image on the CCSP according to requirement.

Deploy a custom image that you move to the CCSP

Use your existing Red Hat subscriptions

The subscriptions includes the Red Hat product cost and support for custom RHEL image, while you pay the CCSP for all other instance costs

Upload your custom image and attach your subscriptions

Deploy an existing RHEL based custom machine image

The custom machine images include a RHEL image

You pay the CCSP on an hourly basis based on a pay-as-you-go model. For this model, on-demand images are available on the CCSP marketplace. The CCSP provides support for these images, while Red Hat handles updates. The CCSP provides updates through the Red Hat Update Infrastructure (RHUI)

Select a RHEL image when you launch an instance on the CCSP cloud management console, or choose an image from the CCSP marketplace.

To convert an on-demand, license-included EC2 instance to a bring-your-own-license (BYOL) EC2 instance of RHEL.

To manually configure a virtual machine (VM), first create a base (starter) image. Then, you can modify configuration settings and add the packages the VM requires to operate on the cloud. You can also make additional configuration changes for your specific application after you upload the image.

Creating a VM from a base image has the following advantages:

  • Fully customizable
  • High flexibility for any use case
  • Lightweight - includes only the operating system and the required runtime libraries

To create a custom base image of RHEL from an ISO image, you can use the command line interface (CLI) or the web console for creating and configuring VM.

Note

Verify the following VM configurations.

  • SSH - Enable SSH to give remote access to your VM.
  • DHCP - Configure the primary virtual adapter to use DHCP.

Prerequisites

  • You have enabled virtualization on the host machine.
  • For web console, ensure the following options:
  • You have not checked the Immediately Start VM option.
  • You have already changed the Memory size to your preferred settings.
  • You have changed the Model option under Virtual Network Interface Settings to virtio and vCPUs to the capacity settings for the VM.

Procedure

  1. Configure the Red Hat Enterprise Linux (RHEL) VM:

    1. To install from the command line (CLI), ensure that you set the default memory, network interfaces, and CPUs according to your requirement for the VM. For details, see Creating virtual machines by using the command line
    2. To install from the web console, see Creating virtual machines by using the web console
  2. When the installation starts:

    1. Create a root password.
    2. Create an administrative user account.
  3. After the installation completes, reboot the VM and log in to the root account.
  4. After logging in as root, you can configure the image.
  5. Register the VM and enable the RHEL repository:

    # subscription-manager register
  6. For AMD64 or Intel 64 (x86_64) VMs, install the nvme, xen-netfront, and xen-blkfront drivers:

    # dracut -f --add-drivers "nvme xen-netfront xen-blkfront"
  7. For ARM 64 (aarch64) VMs, install the nvme driver:

    # dracut -f --add-drivers "nvme"

    Including these drivers prevents a dracut time-out.

    Alternatively, you can add the drivers to /etc/dracut.conf.d/ and then enter dracut -f to overwrite the existing initramfs file.

Verification

  • Verify if the system has the cloud-init package and enable it:

    # dnf install cloud-init
    # systemctl enable --now cloud-init.service
  • Power off the VM.

To run a RHEL instance on Amazon Web Services (AWS), you must first upload a RHEL image to AWS. To configure and manage a RHEL EC2 instance on AWS, use the awscli2 utility.

3.3.1. Installing AWSCLI2

You can use the Amazon Web Services (AWS) command line interface awscli2 utility to configure and manage Red Hat Enterprise Linux (RHEL) images and Red Hat high availability (HA) cluster on AWS.

Prerequisites

Procedure

  • Install awscli2:

    # dnf install awscli2

Verification

  1. Verify the installation:

    $ aws --version
    aws-cli/1.19.77 Python/3.6.15 Linux/5.14.16-201.fc34.x86_64 botocore/1.20.77
  2. Configure awscli2 for AWS credentials and settings:

    $ aws configure
    AWS Access Key ID [None]:
    AWS Secret Access Key [None]:
    Default region name [None]:
    Default output format [None]:

You can convert a Red Hat Enterprise Linux (RHEL) image in the qcow2 image format to OVA, VHD, VHDX, VMDK, or raw by using the qemu-img utility, and then upload it to Amazon S3 storage.

Prerequisites

Procedure

  1. Run qemu-img to convert .qcow2 image to .raw image format:

    # qemu-img convert -f qcow2 -O raw rhel-10.0-sample.qcow2 rhel-10.0-sample.raw
  2. Upload the image to the Amazon S3 bucket:

    $ aws s3 cp rhel-10.0-sample.raw s3://<example-s3-bucket-name>

Verification

You can use the Amazon Web Services (AWS) command line interface awscli2 utility to manage a Red Hat Enterprise Linux (RHEL) Elastic Cloud Compute (EC2) VM on AWS through the command line. You can import a RHEL EC2 image snapshot, create an AMI, launch, and connect to a RHEL EC2 instance.

Prerequisites

Procedure

  1. Use the vmimport role: An alternate to import the RHEL image to the Amazon S3 bucket is by using the vimport role. See Required permissions for VM Import/Export.
  2. Import RHEL image as a snapshot: You can import RHEL VM image from Amazon S3 as a snapshot to Amazon EC2. For details, see Start an import snapshot task and Monitor an import snapshot task.
  3. Create and launch a RHEL EC2 instance: You can create a RHEL Amazon Machine Image (AMI) from existing snapshot and launch a RHEL EC2 instance. For details, see create an AMI from snapshot by using awscli2 and launching, listing, and deleting RHEL instance by using awscli2.
  4. Configure the private key and connect to the RHEL EC2 instance: You can configure your <example_key>.pem file and connect to an RHEL EC2 instance. For details, see Create a key pair using Amazon EC2 and Connect using the AWS CLI.

3.3.4. Attaching Red Hat subscriptions

To register and attach your Red Hat subscription to a RHEL instance, you can use the subscription-manager command.

Prerequisites

Procedure

  1. Register your system:

    # subscription-manager register
  2. Attach your subscriptions:

  3. Optional: To collect various system metrics about the instance in the Red Hat Hybrid Cloud Console, you can register the instance with Red Hat Lightspeed.

    # insights-client register --display-name <display_name_value>

    For information about further configuration of Red Hat Lightspeed, see Client Configuration Guide for Red Hat Lightspeed.

You can deploy Red Hat Enterprise Linux (RHEL) virtual machines (VMs) more efficiently on Amazon Web Services (AWS) by using gold images of RHEL. This ensures that the VMs are automatically registered to the Red Hat Subscription Manager (RHSM).

Prerequisites

  • You have created a Red Hat account.
  • You have signed up and set up an AWS account.
  • You have downloaded the latest RHEL gold image for AWS. For instructions, see Using gold images on AWS.

    Note

    You can only attach an AWS account to a single Red Hat account at a time. Therefore, ensure no other users require access to the AWS account before attaching it to your Red Hat one.

Procedure

  1. Upload the gold image to AWS. For instructions, see one of the following:

  2. Create VMs by using the uploaded image. If your RHSM settings are correct, they will be automatically subscribed to RHSM.

Verification

  • In a RHEL VM created using the above instructions, verify the system is registered to RHSM by executing the subscription-manager identity command. On a successfully registered system, this displays the UUID of the system. For example:

    # subscription-manager identity
    system identity: fdc46662-c536-43fb-a18a-bbcb283102b7
    name: 192.168.122.222
    org name: 6340056
    org ID: 6340056

To run a RHEL instance on Amazon Web Services (AWS), you must first upload the RHEL image to AWS. To configure and manage the RHEL EC2 instance on AWS, use the awscli2 utility.

You can convert a RHEL image in the qcow2 image format to OVA, VHD, VHDX, VMDK, or raw by using the qemu-img utility, and then upload it to Amazon S3 storage by using the AWS console.

Prerequisites

Procedure

  1. Run qemu-img to convert .qcow2 image to .raw image format:

    # qemu-img convert -f qcow2 -O raw rhel-10.0-sample.qcow2 rhel-10.0-sample.raw
  2. Upload the image to the S3 bucket by using Amazon S3 console

Verification

You can manage a Red Hat Enterprise Linux (RHEL) Elastic Cloud Compute (EC2) VM on Amazon Web Services (AWS) by using the AWS console. You can create RHEL EC2 image snapshots, manage Amazon Machine Image (AMI), launch, and connect to a RHEL EC2 instance.

Prerequisites

Procedure

  1. Use the vmimport role: An alternate way to import the RHEL image to the Amazon S3 bucket is by using the vmimport role. See Import your VM as an image.
  2. Import a RHEL image as a snapshot: You can import a RHEL VM image from Amazon S3 as a snapshot to Amazon EC2. For details, see Importing a disk as a snapshot using VM Import/Export and Monitor an import snapshot task.
  3. Create and launch a RHEL EC2 instance: You can create a RHEL Amazon Machine Image (AMI) from an existing snapshot and launch a RHEL EC2 instance. For details, see Create an AMI from a snapshot and Launch an instance using defined parameters.
  4. Configure the private key and connect to the RHEL EC2 instance: You can configure your <example_key>.pem file and connect to an RHEL EC2 instance. For details, see Create a key pair using Amazon EC2 and Connect using the Amazon EC2 console.
  5. For Red Hat subscriptions, see Attaching Red Hat subscriptions
Red Hat logoGithubredditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust. Explore our recent updates.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Theme

© 2026 Red Hat
Back to top