3.4.2. Managing a RHEL VM on AWS by using the AWS console
You can manage RHEL Elastic Cloud Compute (EC2) virtual machines (VMs) 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
- You have created a Red Hat account.
- You have signed up and set up an AWS account.
- You have pushed your RHEL image to the Amazon S3 bucket by using the AWS console.
Procedure
-
Open the AWS Management Console. Search for
IAM, open IAM, choose Roles, then choose Create role forvmimport. In the Trusted entity type field, choose Custom trust policy. Paste the
vmie.amazonaws.comtrust policy from the VM Import/Export documentation, then choose Next.Add permissions: skip managed policies if you add an inline VM Import/Export policy next; otherwise attach required policies, then Next.
Role name
vmimport, Create role.In case of adding permissions, open the role. Choose the Permissions tab, choose Add permissions, choose Create inline policy, then choose the JSON tab. Paste the
vmimportaccess policy with your S3 bucket ARNs, then choose Create policy.Open CloudShell from the toolbar or global search.
In the CloudShell pane, set the Region selector to the same Region as your S3 object.
At the CloudShell (where the shell accepts
awscommands, not the console Search field), enteraws ec2 import-snapshotwith your disk container file, thenaws ec2 describe-import-snapshot-tasksuntil the import status iscompleted.In the Amazon EC2 console, open Elastic Block Store, choose Snapshots, and confirm the snapshot ID.
On Snapshots, select the snapshot, open Actions, choose Create image from snapshot, then finish the wizard.
- Open Images, choose AMIs, select the AMI, choose Launch instance from AMI, then finish the wizard.
If you need a key pair, choose Network & Security, Key pairs, then Create key pair, and choose
.pem.Save
<example_key>.pemwith restrictive file permissions.- Choose Instances, select the instance, choose Connect, then open EC2 Instance Connect or SSH client.
- On the instance, register Red Hat subscriptions.
Verification
Verify that the snapshot import finished successfully with the
completedstatus:$ aws ec2 describe-import-snapshot-tasks --import-task-ids <example_import_task_id>Verify that the AMI is available with the
availablestate:$ aws ec2 describe-images --image-ids <example_registered_ami_id>Verify that the instance is running with the
runningstate:$ aws ec2 describe-instances --instance-ids <example_instance_id>The
State.Namevalue isrunningwhen the instance has finished starting.Verify that the SSH connection works:
$ ssh -i <example_key>.pem ec2-user@<instance_public_dns_or_ip> 'echo connected'