Chapter 5. Deploying cloud images with Image Builder
Chapter 5. Deploying cloud images with Image Builder Image Builder can create custom system images ready for use in clouds of various providers. To use your customized RHEL system image in a cloud, create the system image with Image Builder using the respective output type, configure your system for uploading the image, and upload the image to your cloud account. 5.1. Preparing AWS AMI images for upload This section describes steps to configure a system for uploading AWS AMI images. Prerequisites You must have an Access Key ID configured in the AWS IAM account manager . You must have a writable S3 bucket prepared. Procedure 1. Install Python 3 and the pip tool: 2. Install the AWS command-line tools with pip: 3. Configure the AWS command-line client according to your AWS access details: 4. Configure the AWS command-line client to use your bucket: Replace bucketname with the actual bucket name. 5. Create a vmimport S3 Role in IAM and grant it permissions to access S3, if you have not already done so:
yum install python3 python3-pip pip3 install awscli aws configure AWS Access Key ID [None]: AWS Secret Access Key [None]: Default region name [None]: Default output format [None]: BUCKET=bucketname aws s3 mb s3://USDBUCKET printf '{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "vmie.amazonaws.com" }, "Action": "sts:AssumeRole", "Condition": { "StringEquals":{ "sts:Externalid": "vmimport" } } } ] }' > trust-policy.json USD 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":"*" } ] }' USDBUCKET USDBUCKET > role-policy.json USD aws iam create-role --role-name vmimport --assume-role-policy-document file://trust-policy.json USD aws iam put-role-policy --role-name vmimport --policy-name vmimport --policy-document file://role-policy.json