Ce contenu n'est pas disponible dans la langue sélectionnée.
Chapter 12. Creating RHEL for Edge AMI images
You can create a RHEL for Edge edge-ami customized image by using RHEL image builder. The RHEL for Edge edge-ami has Ignition support to inject the user configuration into the images at an early stage of the boot process. Then, you can upload the image to AWS cloud and launch an EC2 instance in AWS. You can use the AMI image type on AMD or Intel 64-bit architectures.
12.1. Creating a blueprint for Edge AMI images Copier lienLien copié sur presse-papiers!
Create a blueprint for the edge-ami image and customize it with the customizations.ignition section. With that, you can create your image and when booting the image, inject the user configuration.
Prerequisites
You have created an Ignition configuration file. For example:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow For more details, see Creating an Ignition configuration file.
Procedure
Create a blueprint in the Tom’s Obvious, Minimal Language (TOML) format, with the following content:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Where:
-
The
nameis the name anddescriptionis the description for your blueprint. -
The
versionis the version number according to the Semantic Versioning scheme. -
The
modulesandpackagesdescribe the package name and matching version glob to be installed into the image. For example, the packagename = "open-vm-tools". Notice that currently there are no differences between packages and modules. -
The
groupsare packages groups to be installed into the image. For examplegroups = "wheel". If you do not know the modules and groups, leave them empty. -
The
customizations.usercreates a username and password to log in to the VM. The
customizations.ignition.firstbootcontains the URL where the Ignition configuration file is being served.NoteBy default, the
open-vm-toolspackage is not included in theedge-vsphereimage. If you need this package, you must include it in the blueprint customization.
-
The
Import the blueprint to the image builder server:
composer-cli blueprints push <blueprint-name>.toml
# composer-cli blueprints push <blueprint-name>.tomlCopy to Clipboard Copied! Toggle word wrap Toggle overflow List the existing blueprints to check whether the created blueprint is successfully pushed and exists:
composer-cli blueprints show <blueprint-name>
# composer-cli blueprints show <blueprint-name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Check whether the components and versions listed in the blueprint and their dependencies are valid:
composer-cli blueprints depsolve <blueprint-name>
# composer-cli blueprints depsolve <blueprint-name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow
12.2. Creating a RHEL for Edge AMI image Copier lienLien copié sur presse-papiers!
Create a RHEL for Edge edge-ami image in the RHEL image builder command-line interface.
Prerequisites
-
You created a blueprint for the
edge-amiimage. -
You served an OSTree repository of the commit to embed it in the image. For example,
http://10.0.2.2:8080/repo. For more details, see Setting up a web server to install RHEL for Edge image.
Procedure
Start the compose of a
edge-amiimage:composer-cli compose start-ostree <blueprint-name> edge-ami --ref rhel/9/x86_64/edge --url <ostree repo url>
# composer-cli compose start-ostree <blueprint-name> edge-ami --ref rhel/9/x86_64/edge --url <ostree repo url>Copy to Clipboard Copied! Toggle word wrap Toggle overflow The
<ostree repo url>is the URL of your repo, for example:http://10.88.0.1:8080/{<blueprint-name>}/repo.A confirmation that the composer process has been added to the queue appears. It also shows a Universally Unique Identifier (UUID) number for the image created. Use the UUID number to track your build. Also, keep the UUID number handy for further tasks.
Check the image compose status:
composer-cli compose status
# composer-cli compose statusCopy to Clipboard Copied! Toggle word wrap Toggle overflow The output displays the status in the following format:
<UUID> RUNNING date <blueprint-name> <blueprint-version> edge-ami
$ <UUID> RUNNING date <blueprint-name> <blueprint-version> edge-amiCopy to Clipboard Copied! Toggle word wrap Toggle overflow After the compose process finishes, download the resulting image file:
composer-cli compose image <UUID>
# composer-cli compose image <UUID>Copy to Clipboard Copied! Toggle word wrap Toggle overflow
12.3. Uploading a RHEL Edge AMI image to AWS Copier lienLien copié sur presse-papiers!
Upload the edge-ami image to Amazon AWS Cloud service provider by using the CLI.
Prerequisites
-
You have an
Access Key IDconfigured in the AWS IAM account manager. - You have a writable S3 bucket prepared.
- You have created the required roles for your AWS bucket.
-
You have the
aws-clitool installed .
Procedure
Configure the
aws-clitool:aws configure
$ aws configureCopy to Clipboard Copied! Toggle word wrap Toggle overflow Configure your profile. Run the command and enter your Access key ID credential, Secret access key, Default region name, and default output name:
aws configure --profile
$ aws configure --profileCopy to Clipboard Copied! Toggle word wrap Toggle overflow
List the existing buckets:
aws s3 ls
$ aws s3 lsCopy to Clipboard Copied! Toggle word wrap Toggle overflow Upload your image to S3:
aws s3 cp <path_to_image/image> s3://<your_bucket_name>
$ aws s3 cp <path_to_image/image> s3://<your_bucket_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow List the image in the S3 bucket:
aws s3 ls s3://<your_bucket_name>
$ aws s3 ls s3://<your_bucket_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a
container-simple.jsonfile. Replace the "URL" content with the S3 bucket. For example:s3://rhel-edge-ami-us-west-2/2ba3c125-cc58-4cc0-861a-4cc78e892df6-image.raw.{ "Description": "RHEL for Edge image", "Format": "edge-ami", "Url": "s3://rhel-edge-ami-us-west-2/UUID-image.raw" }{ "Description": "RHEL for Edge image", "Format": "edge-ami", "Url": "s3://rhel-edge-ami-us-west-2/UUID-image.raw" }Copy to Clipboard Copied! Toggle word wrap Toggle overflow Import the
edge.amiimage to the S3 bucket as an EC2 snapshot.NoteThe EC2 image must be in the same region that you have created the S3 bucket.
aws ec2 import-snapshot --description "RHEL edge" \ --disk-container file://container-simple.json --region us-west-2
$ aws ec2 import-snapshot --description "RHEL edge" \ --disk-container file://container-simple.json --region us-west-2Copy to Clipboard Copied! Toggle word wrap Toggle overflow The following .
jsonis an example of the command output:{ "Description": "RHEL for Edge image", "Format": "edge-ami", "Url": "s3://rhel-edge-ami-us-west-2/UUID-image.raw" }{ "Description": "RHEL for Edge image", "Format": "edge-ami", "Url": "s3://rhel-edge-ami-us-west-2/UUID-image.raw" }Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Take note of "ImportTaskId" value from the
.jsonfile. Use it to check the import status. In this example, the "ImportTaskId" isimport-snap-0f3055c4b7a454c85. Check the import status of the snapshot, by using the "ImportTaskId" value from the output
.jsonfile from the previous step:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Run this command until the "Status" is marked as "completed".
Register the
edge.amiimage to be able to launch an instance from the image.aws ec2 register-image \ --name ami-edge-name-ami-x86" \ --architecture <architecture> \ --tag-specifications 'ResourceType=image,Tags=\\\{Key=Name,Value={{ blueprint_name }}-ami-x86}' \ --root-device-name /dev/sda1 \ --block-device-mappings DeviceName=/dev/sda1,Ebs={SnapshotId={{ snapshot_id }}} DeviceName=/dev/sdh,Ebs={VolumeSize=10} \ --boot-mode uefi-preferred --query="ImageId" --output=text \ --region="{{ aws_region }}" i$ aws ec2 register-image \ --name ami-edge-name-ami-x86" \ --architecture <architecture> \ --tag-specifications 'ResourceType=image,Tags=\\\{Key=Name,Value={{ blueprint_name }}-ami-x86}' \ --root-device-name /dev/sda1 \ --block-device-mappings DeviceName=/dev/sda1,Ebs={SnapshotId={{ snapshot_id }}} DeviceName=/dev/sdh,Ebs={VolumeSize=10} \ --boot-mode uefi-preferred --query="ImageId" --output=text \ --region="{{ aws_region }}" iCopy to Clipboard Copied! Toggle word wrap Toggle overflow If you do not specify an architecture, it defaults to the
i386architecture.
After registering the image, you can access EC2 to create the AMI image from the snapshot, and launch it.
Verification
To confirm that the image upload was successful:
- Access EC2 in the menu and select the correct region in the AWS console. The image must have the available status, to indicate that it was successfully uploaded.
On the dashboard, select your image and click Launch.
When launching the new instance, you must select UEFI as the boot mode, and choose at least 4GB of RAM for the EC2 image.
-
You can log in into the
edge-amion AWS by using the username and password you created with the Ignition configuration.