Chapter 2. Installing RHEL AI on AWS


There are 2 ways you can install and deploy Red Hat Enterprise Linux AI on AWS:

2.1. Converting the RHEL AI RAW image to an AMI

Before deploying RHEL AI on an AWS machine, you must set up an Amazon S3 bucket, convert the RHEL AI image to an Amazon Machine Image (AMI), and create the following resources:

  • S3 bucket with the RHEL AI image
  • AWS EC2 snapshot
  • AWS AMI
  • AWS instance

Prerequisites

Procedure

  1. Create an S3 bucket and set the permissions to allow image file conversion to AWS snapshots.

    1. Create the necessary environment variables. Open a shell prompt and run the following commands:

      $ export BUCKET=<CUSTOM_BUCKET_NAME>
      $ export RAW_AMI=nvidia-bootc.ami
      $ export AMI_NAME="rhel-ai"
      $ export DEFAULT_VOLUME_SIZE=1000
      Copy to Clipboard Toggle word wrap
    2. Create the S3 bucket by running the following command:

      $ aws s3 mb s3://$BUCKET
      Copy to Clipboard Toggle word wrap
    3. Create the trust-policy.json file with the necessary configuration for generating an S3 role for your bucket:

      $ printf '{
        "Version": "2012-10-17",
        "Statement": [
          {
            "Effect": "Allow",
            "Principal": {
              "Service": "vmie.amazonaws.com"
            },
            "Action": "sts:AssumeRole",
            "Condition": {
              "StringEquals": {
                "sts:Externalid": "vmimport"
              }
            }
          }
        ]
      }' > trust-policy.json
      Copy to Clipboard Toggle word wrap
    4. Create the S3 role for your bucket. Run the following command:

      $ aws iam create-role --role-name vmimport --assume-role-policy-document file://trust-policy.json
      Copy to Clipboard Toggle word wrap
    5. Create the role-policy.json file with the necessary configurations for generating a policy for your bucket:

      $ printf '{
        "Version": "2012-10-17",
        "Statement": [
          {
            "Effect": "Allow",
            "Action": [
              "s3:GetBucketLocation",
              "s3:GetObject",
              "s3:ListBucket"
            ],
            "Resource": [
              "arn:aws:s3:::%s",
              "arn:aws:s3:::%s/*"
            ]
          },
          {
            "Effect": "Allow",
            "Action": [
              "ec2:ModifySnapshotAttribute",
              "ec2:CopySnapshot",
              "ec2:RegisterImage",
              "ec2:Describe*"
            ],
            "Resource": "*"
          }
        ]
      }' $BUCKET $BUCKET > role-policy.json
      Copy to Clipboard Toggle word wrap
    6. Create the policy for your bucket by running the following command:

      $ aws iam put-role-policy --role-name vmimport --policy-name vmimport-$BUCKET --policy-document file://role-policy.json
      Copy to Clipboard Toggle word wrap
  2. Copy the x86_64 RAW image URL from the Download Red Hat Enterprise Linux AI page and download the image using curl:

    $ curl -Lo disk.raw.gz <RAW_IMAGE_URL>
    Copy to Clipboard Toggle word wrap
  3. Unzip the raw.gz file:

    $ gunzip disk.raw.gz
    Copy to Clipboard Toggle word wrap
  4. Upload the image to the S3 bucket with the following command:

    $ aws s3 cp disk.raw s3://$BUCKET/$RAW_AMI
    Copy to Clipboard Toggle word wrap
  5. Convert the image to a snapshot and store it in the TASK_ID variable name by running the following commands:

    $ printf '{
       "Description":"rhelai-image",
       "Format":"raw",
       "UserBucket":{
          "S3Bucket":"%s",
          "S3Key":"%s"
       }
    }' $BUCKET $RAW_AMI > containers.json
    Copy to Clipboard Toggle word wrap
    $ TASK_ID=$(aws ec2 import-snapshot --disk-container file://containers.json | jq -r .ImportTaskId)
    Copy to Clipboard Toggle word wrap
  6. Follow the progress of the disk image to snapshot conversion job with the following command:

    $ aws ec2 describe-import-snapshot-tasks --filters Name=task-state,Values=active
    Copy to Clipboard Toggle word wrap
  7. Get the snapshot ID and store it the SNAPSHOT_ID variable by running the following command:

    $ SNAPSHOT_ID=$(aws ec2 describe-import-snapshot-tasks | jq -r '.ImportSnapshotTasks[] | select(.ImportTaskId=="'${TASK_ID}'") | .SnapshotTaskDetail.SnapshotId')
    Copy to Clipboard Toggle word wrap
  8. Add a tag name to the snapshot by running the following command:

    $ aws ec2 create-tags --resources $SNAPSHOT_ID --tags Key=Name,Value="$AMI_NAME"
    Copy to Clipboard Toggle word wrap
  9. Register the AMI from the snapshot with the following command:

    $ AMI_ID=$(aws ec2 register-image \
    --name "$AMI_NAME" \
    --description "$AMI_NAME" \
    --architecture x86_64 \
    --root-device-name /dev/sda1 \
    --block-device-mappings "DeviceName=/dev/sda1,Ebs={VolumeSize=${DEFAULT_VOLUME_SIZE},SnapshotId=${SNAPSHOT_ID}}" \
    --virtualization-type hvm \
    --ena-support \
    | jq -r .ImageId)
    Copy to Clipboard Toggle word wrap
  10. Add a tag name to identify the AMI by running the following command:

    $ aws ec2 create-tags --resources $AMI_ID --tags Key=Name,Value="$AMI_NAME"
    Copy to Clipboard Toggle word wrap

2.2. Deploying on AWS using the CLI

You can launch the Red Hat Enterprise Linux AI AWS instance by using the RHEL AI Amazon Machine Image (AMI) from the AWS web console or by using the awscli CLI.

The following procedure describes how to use the awscli CLI to launch the AWS instance with the custom AMI.

Prerequisites

  • You have created the RHEL AI AMI.
  • You have installed the awscli CLI, and configured it with your aws_access_key_id and aws_secret_access_key variables.
  • You have configured your Virtual Private Cloud (VPC).
  • You have created a subnet for your instance.
  • You have created an SSH key pair.
  • You have created an AWS security group on.

Procedure

  1. Configure the various AWS parameters.

    1. Set the AMI variable. Run the following command and copy the required AMI ID:

      $ aws ec2 describe-images --owners self
      Copy to Clipboard Toggle word wrap
      $ AMI=<AMI_ID>
      Copy to Clipboard Toggle word wrap
    2. Set the SECURITY_GROUP variable. Run the following command and copy the required security group ID:

      $ aws ec2 describe-security-groups
      Copy to Clipboard Toggle word wrap
      $ SECURITY_GROUP=<SECURITY_GROUP_ID>
      Copy to Clipboard Toggle word wrap
    3. Set the SUBNET variable. Run the following command and copy the required subnet:

      $ aws ec2 describe-subnets
      Copy to Clipboard Toggle word wrap
      $ SUBNET=<SUBNET>
      Copy to Clipboard Toggle word wrap
    4. Set the INSTANCE_TYPE variable:

      $ INSTANCE_TYPE=<INSTANCE_TYPE_SIZE>
      Copy to Clipboard Toggle word wrap
    5. Set the INSTANCE_NAME variable:

      $ INSTANCE_NAME=rhel-ai-instance
      Copy to Clipboard Toggle word wrap
    6. Set the disk size variable:

      $ DISK_SIZE=<REQUIRED_DISK_SIZE>
      Copy to Clipboard Toggle word wrap
    7. Set the KEY_NAME variable:

      $ KEY_NAME=<KEY_PAIR_NAME>
      Copy to Clipboard Toggle word wrap
  2. Create the instance by running the following command:

    $ aws ec2 run-instances \
    --image-id $AMI \
    --instance-type $INSTANCE_TYPE \
    --key-name $KEY_NAME \
    --security-group-ids $SECURITY_GROUP \
    --subnet-id $SUBNET \
    --block-device-mappings DeviceName=/dev/sda1,Ebs='{VolumeSize='$DISK_SIZE'}' \
    --tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value='$INSTANCE_NAME'}]'
    Copy to Clipboard Toggle word wrap
    Important

    The default user account in the RHEL AI AMI is cloud-user. The cloud-user account has passwordless sudo access.

Back to top
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

© 2025 Red Hat