Configure RES-ready AMIs
With RES-ready Amazon Machine Images (AMIs), you can pre-install RES dependencies for virtual desktop instances (VDIs) on your custom AMIs. Using RES-ready AMIs improve boot times for VDI instances using the pre-baked images. Using EC2 Image Builder, you can build and register your AMIs as new software stacks. For more information on Image Builder, see the Image Builder User Guide.
Before you begin, you must deploy the latest version of RES.
Topics
Prepare an IAM role to access RES environment
To access the RES environment service from EC2 Image Builder, you must create or modify an IAM role called RES-EC2InstanceProfileForImageBuilder. For information on configuring an IAM role for use in Image Builder, see AWS Identity and Access Management (IAM) in the Image Builder User Guide.
Your role requires:
-
Trusted relationships that include the Amazon EC2 service.
-
AmazonSSMManagedInstanceCore and EC2InstanceProfileForImageBuilder policies.
-
A custom RES policy with limited DynamoDB and Amazon S3 access to the deployed RES environment.
(This policy can be either a customer managed or customer inline policy document.)
-
Start by creating a new policy that will be attached to your role: IAM -> Policies -> Create policy
-
Select JSON from the policy editor.
-
Copy and paste the policy shown here into the editor, replacing your desired
{AWS-Region}
,{AWS-Account-ID}
, and{RES-EnvironmentName}
where applicable.RES policy:
{ "Version": "2012-10-17", "Statement": [ { "Sid": "RESDynamoDBAccess", "Effect": "Allow", "Action": "dynamodb:GetItem", "Resource": "arn:aws:dynamodb:
{AWS-Region}
:{AWS-Account-ID}
:table/{RES-EnvironmentName}
.cluster-settings", "Condition": { "ForAllValues:StringLike": { "dynamodb:LeadingKeys": [ "global-settings.gpu_settings.*", "global-settings.package_config.*", "cluster-manager.host_modules.*", "identity-provider.cognito.enable_native_user_login" ] } } }, { "Sid": "RESS3Access", "Effect": "Allow", "Action": "s3:GetObject", "Resource": [ "arn:aws:s3:::{RES-EnvironmentName}
-cluster-{AWS-Region}
-{AWS-Account-ID}
/idea/vdc/res-ready-install-script-packages/*", "arn:aws:s3:::research-engineering-studio-{AWS-Region}
/host_modules/*" ] } ] } -
Choose Next and provide a name and optional description to complete the policy creation.
-
To create the role, start by going to IAM -> Roles -> Create role.
-
Under Trusted Entity Type, select "AWS service".
-
Select EC2 in the Service or use case drop down.
-
In the Use case section, select EC2, then choose Next.
-
Search for and then select the name of the policy you previously created.
-
Choose Next and provide a name and optional description to complete the role creation.
-
Select your new role and verify that the Trust relationship matches the following:
Trusted relationship entity:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "ec2.amazonaws.com" }, "Action": "sts:AssumeRole" } ] }
Create EC2 Image Builder component
Follow the directions to Create a component using the Image Builder console in the Image Builder User Guide.
Enter your component details:
-
For Type, choose Build.
-
For Image operating system (OS), choose either Linux or Windows.
-
For Component name, enter a meaningful name such as
research-and-engineering-studio-vdi-<operating-system>
. -
Enter your component's version number and optionally add a description.
-
For the Definition document, enter the following definition file. If you encounter any errors, the YAML file is space sensitive and is the most likely cause.
-
Create any optional tags and choose Create component.
Prepare your EC2 Image Builder recipe
An EC2 Image Builder recipe defines the base image to use as your starting point to create a new image, along with the set of components that you add to customize your image and verify that everything works as expected. You must either create or modify a recipe to construct the target AMI with the necessary RES software dependencies. For more information on recipes, see Manage recipes.
RES supports the following image operating systems:
-
Amazon Linux 2 (x86 and ARM64)
-
Ubuntu 22.04.3 (x86)
-
RHEL 8 (x86), and 9 (x86)
-
Windows 2019, 2022 (x86)
Configure EC2 Image Builder infrastructure
You can use infrastructure configurations to specify the Amazon EC2 infrastructure that Image Builder uses to build and test your Image Builder image. For use with RES, you can choose to create a new infrastructure configuration, or use an existing one.
-
To create a new infrastructure configuration, see Create an infrastructure configuration.
-
To use an existing infrastructure configuration, Update an infrastructure configuration.
To configure your Image Builder infrastructure:
-
For IAM role, enter the role you previously configured in Prepare an IAM role to access RES environment.
-
For Instance type, choose a type with at least 4 GB of memory and supports your chosen base AMI architecture. See Amazon EC2 Instance types
. -
For VPC, subnet, and security groups, you must permit internet access to download software packages. Access must also be allowed to the
cluster-settings
DynamoDB table and Amazon S3 cluster bucket of the RES environment.
Configure Image Builder image pipeline
The Image Builder image pipeline assembles the base image, components for building and testing, infrastructure configuration, and distribution settings. To configure an image pipeline for RES-ready AMIs, you can choose to create a new pipeline, or use an existing one. For more information, see Create and update AMI image pipelines in the Image Builder User Guide.
Run Image Builder image pipeline
To produce the output image configured, you must initiate the image pipeline. The building process can potentially take up to an hour depending on the number of components in the image recipe.
To run the image pipeline:
-
From Image pipelines, select the pipeline created in Configure Image Builder image pipeline.
-
From Actions, choose Run pipeline.
Register a new software stack in RES
-
Follow the directions in Software Stacks (AMIs) to register a software stack.
-
For AMI ID, enter the AMI ID of the output image built in Run Image Builder image pipeline.