Chapter 5. Creating and uploading a customized RHEL system image to Amazon Web Service using Red Hat Image Builder
The ability to create customized RHEL system images by using Red Hat Image Builder and upload those images to the Amazon Web Services (AWS) target environment is available.
5.1. Creating and uploading a customized RHEL system image to AWS using Image Builder
Follow the steps to create customized system images using Red Hat Image Builder and upload those images to Amazon Web Services (AWS).
Access Red Hat Image Builder on the browser of your choice.
You are redirected to the Red HatImage Builder dashboard.
A Create a new image dialog window opens.
In the Image output window:
- From the dropdown menu, select the Release: Red Hat Enterprise Linux (RHEL) 8.3.
Amazon Web Servicesas the target environment.
In the Target Environment- Upload to AWS window, enter your AWS account ID.
Your image will be uploaded to Amazon Web Services and shared with the account ID you entered. You can find your AWS account ID by accessing the option My account on the AWS console. Click Next.
In the Registration window, you have the option to:
- Embed an activation key and register systems on first boot. For details on how to embed an activation key and register systems on first boot, see Chapter 3, Creating a customized system image with an embed subscription using Red Hat Image Builder.
Select the option Register the system later to register the system after the image creation.
- Optional: In the Additional package window, add packages to your image. See Chapter 4, Adding packages during image creation by Using Red Hat Image Builder.
In the Review window, review the details about the image creation and click Create.
Red Hat Image Builder starts the compose of a RHEL 8.3 AMI image for the x86_64 architecture and uploads it to AWS EC2. Then, it will share the AMI with the account you specified.
The Red Hat Image Builder Images dashboard opens. You can see details such as the Image UUID, the cloud target environment, the image OS release and the status of the image creation. Once the status is Ready, the Azure Disk Image is shared with the specified account.
- Pending: the image upload and cloud registration is being processed.
- In Progress: the image upload and cloud registration is ongoing.
- Ready: the image upload and cloud registration is completed
Failed: the image upload and cloud registration failed.Note
The image build, upload and cloud registration processes can take up to ten minutes to complete.
- Check if the image status is Ready. It means that the image upload and cloud registration is completed successfully.
5.2. Accessing your customized RHEL system image for AWS from your account
After the image is built, uploaded, and the cloud registration process status is marked as Ready, you can access the Amazon Web Services (AWS) image you created and shared with your AWS EC2 account.
- You have access to your AWS Management Console.
- Access your AWS account and navigate to Service→EC2.
In the upper right menu, verify if you are under the correct region:
In the left side menu, under Images, click AMIs.
The dashboard with the Owned by me images opens.
From the dropdown menu, choose Private images.
You can see the image successfully shared with the AMI account you specified.
5.3. Launching your customized RHEL system image for AWS from your AWS EC2
You can launch the image you successfully shared with the AWS EC2 account you have specified. To do so, follow the steps:
- You have access to your customized image on AWS. See Section 5.2, “Accessing your customized RHEL system image for AWS from your account”.
- From the list of images, select the image you want to launch.
- On the top of the panel, Launch. You are redirected to the Choose an Instance Type window.
- Choose the instance type according to the resources you need to launch your image. Review and Launch.
- Review your instance launch details. You can edit each section, such as Security, Storage, for example, if you need to make any change. Once you finish the review, click .
To launch the instance, you must select a public key to access it.
Create a new key pair in EC2 and attach it to the new instance.
- From the drop-down menu list, select Create a new key pair.
- Enter the name to the new key pair. It generates a new key pair.
- Click Download Key Pair to save the new key pair on your local system.
Then, you can clickto launch your instance.
You can check the status of the instance, it shows as Initializing.
- Once the instance status is running, the Connect button turns available.
Click. A popup window appears with instructions on how to connect using SSH.
- Select the preferred connection method to A standalone SSH client and open a terminal.
In the location you store your private key, make sure that your key is publicly viewable for SSH to work. To do so, run the command:
$ chmod 400 <your-instance-name.pem>
Connect to your instance using its Public DNS:
$ ssh -i "<_your-instance-name.pem_"> ec2-user@<_your-instance-IP-address_>
- Type yes to confirm that you want to continue connecting.
As a result, you are connected to your instance using SSH.
- From a terminal, check if you are able to perform any action while connected to your instance using SSH.
5.4. Copying your customized RHEL system image for AWS to a different region on your AWS EC2
You can copy the image you successfully shared with the Amazon Web Services EC2 to your own account. Doing so, you grant that the image you shared and copied is available until you delete it, instead of expiring after some time. To copy your image to your own account, follow the steps:
- You have access to your customized image on AWS. See Section 5.2, “Accessing your customized RHEL system image for AWS from your account”
- From the list of Public images, select the image you want to copy.
- On the top of the panel, click .
- From the dropdown menu, choose Copy AMI. A popup window appears.
- Choose the Destination region and click Copy AMI.
Once the copying process is complete, you are provided with the new AMI ID. You can launch a new instance in the new region. See Section 5.3, “Launching your customized RHEL system image for AWS from your AWS EC2”
When you copy an image to a different region, it results in a separate and new AMI in the destination region, with a unique AMI ID.