本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
配置 RES-ready AMI
借助 RES-ready Amazon 系统映像 (AMI),您可以在自定义 AMI 上预安装虚拟桌面实例 (VDI) 的 RES 依赖项。使用 RES-ready AMI 可以缩短使用预烘焙映像的 VDI 实例的启动时间。使用 EC2 Image Builder,您可以构建 AMI 并将其注册为新的软件堆栈。有关 Image Builder 的更多信息,请参阅 Image Builder 用户指南。
在开始之前,必须部署最新版本的 RES。
准备一个 IAM 角色以访问 RES 环境
要从 EC2 Image Builder 访问 RES 环境服务,您必须创建或修改名为的 IAM 角色 RES-EC2InstanceProfileForImageBuilder。有关配置在 Image Builder 中使用的 IAM 角色的信息,请参阅 Imag e Builder 用户指南中的 AWS Identity and Access Management (IAM)。
创建 EC2 Image Builder 组件
按照《Image Builder 用户指南》中的说明使用 Image Builder 控制台创建组件。
输入您的组件详细信息:
-
对于 “类型”,选择 “构建”。
-
对于映像操作系统 (OS),请选择 Linux 或 Windows。
-
在 “组件名称” 中,输入一个有意义的名称,例如research-and-engineering-studio-vdi-<operating-system>。
-
输入组件的版本号,也可以添加描述。
key : value
-
在定义文档中,输入以下定义文件。如果您遇到任何错误,那么 YAML 文件对空间很敏感,很可能是原因。
在定义文件中,如果您的 RES 环境版本不是最新版本,请将下载 URI (- source: 's3://research-engineering-studio-us-east-1/releases/latest/res-installation-scripts.tar.gz'2025.06) latest 中的替换为确切的版本号(例如)。
- Linux
-
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
# with the License. A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES
# OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions
# and limitations under the License.
name: research-and-engineering-studio-vdi-linux
description: An RES EC2 Image Builder component to install required RES software dependencies for Linux VDI.
schemaVersion: 1.0
parameters:
- GPUFamily:
type: string
description: GPU family (NONE, NVIDIA, or AMD)
default: NONE
phases:
- name: build
steps:
- name: PrepareRESBootstrap
action: ExecuteBash
onFailure: Abort
maxAttempts: 3
inputs:
commands:
- "mkdir -p /root/bootstrap/logs"
- "mkdir -p /root/bootstrap/latest"
- name: DownloadRESLinuxInstallPackage
action: S3Download
onFailure: Abort
maxAttempts: 3
inputs:
- source: "s3://research-engineering-studio-us-east-1/releases/latest/res-installation-scripts.tar.gz"
destination: "/root/bootstrap/res-installation-scripts/res-installation-scripts.tar.gz"
- name: RunInstallScript
action: ExecuteBash
onFailure: Abort
maxAttempts: 3
inputs:
commands:
- "cd /root/bootstrap/res-installation-scripts"
- "tar -xf res-installation-scripts.tar.gz"
- "cd scripts/virtual-desktop-host/linux"
- "/bin/bash install.sh -g {{ GPUFamily }}"
- name: RunInstallPostRebootScript
action: ExecuteBash
onFailure: Abort
maxAttempts: 3
inputs:
commands:
- "cd /root/bootstrap/res-installation-scripts/scripts/virtual-desktop-host/linux"
- 'sed -i ''/^export AWS_DEFAULT_PROFILE="bootstrap_profile"$/d'' install_post_reboot.sh'
- "/bin/bash install_post_reboot.sh -g {{ GPUFamily }}"
- name: PreventAL2023FromUninstallingCronie
action: ExecuteBash
onFailure: Abort
maxAttempts: 3
inputs:
commands:
- "rm -f /tmp/imagebuilder_service/crontab_installed"
- Windows
-
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
# with the License. A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES
# OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions
# and limitations under the License.
name: research-and-engineering-studio-vdi-windows
description: An RES EC2 Image Builder component to install required RES software dependencies for Windows VDI.
schemaVersion: 1.0
phases:
- name: build
steps:
- name: CreateRESBootstrapFolder
action: CreateFolder
onFailure: Abort
maxAttempts: 3
inputs:
- path: 'C:\Users\Administrator\RES\Bootstrap'
overwrite: true
- name: DownloadRESWindowsInstallPackage
action: S3Download
onFailure: Abort
maxAttempts: 3
inputs:
- source: 's3://research-engineering-studio-us-east-1/releases/latest/res-installation-scripts.tar.gz'
destination: '{{ build.CreateRESBootstrapFolder.inputs[0].path }}\res-installation-scripts.tar.gz'
- name: RunInstallScript
action: ExecutePowerShell
onFailure: Abort
maxAttempts: 3
inputs:
commands:
- 'cd {{ build.CreateRESBootstrapFolder.inputs[0].path }}'
- 'tar -xf res-installation-scripts.tar.gz'
- 'Import-Module .\scripts\virtual-desktop-host\windows\Install.ps1'
- 'Install-WindowsEC2Instance -PrebakeAMI'
-
创建任何可选标签并选择创建组件。
准备好您的 EC2 Image Builder 配方
EC2 Image Builder 配方定义了作为创建新映像起点的基础映像,以及定义了您添加的一组用于自定义映像并验证一切是否按预期运行的组件。您必须创建或修改配方才能构造具有必要的 RES 软件依赖项的目标 AMI。有关食谱的更多信息,请参阅管理食谱。
RES 支持以下图像操作系统:
- Create a new recipe
-
-
打开 EC2 Image Builder 控制台,网址为https://console.aws.amazon.com/imagebuilder。
-
在 “已保存的资源” 下,选择图片配方。
-
选择创建映像配方。
-
输入唯一的名称和版本号。
-
选择 RES 支持的基础镜像。
-
在 “实例配置” 下,如果未预安装 SSM 代理,请安装。在用户数据和任何其他需要的用户数据中输入信息。
-
对于基于 Linux 的配方,请将 Amazon-managed aws-cli-version-2-linux构建组件添加到配方中。RES 安装脚本使用提供对 DynamoDB 集群设置配置值的 VDI 访问权限。AWS CLIWindows 不需要这个组件。
-
添加为您的 Linux 或 Windows 环境创建的 EC2 Image Builder 组件。
对于 Linux 环境,必须按顺序添加这些组件,并先添加aws-cli-version-2-linux构建组件。
-
(推荐)添加 Amazon-managed simple-boot-test-<linux-or-windows>测试组件以验证 AMI 是否可以启动。这是最低限度的建议。您可以选择其他符合您要求的测试组件。
-
如果需要,请完成所有可选部分,添加任何其他所需的组件,然后选择 “创建配方”。
- Modify a recipe
-
如果您已有 EC2 Image Builder 配方,则可以通过添加以下组件来使用它:
-
对于基于 Linux 的配方,请将 Amazon-managed aws-cli-version-2-linux构建组件添加到配方中。RES 安装脚本使用提供对 DynamoDB 集群设置配置值的 VDI 访问权限。AWS CLIWindows 不需要这个组件。
-
添加为您的 Linux 或 Windows 环境创建的 EC2 Image Builder 组件。
对于 Linux 环境,必须按顺序添加这些组件,并先添加aws-cli-version-2-linux构建组件。
-
如果需要,请完成所有可选部分,添加任何其他所需的组件,然后选择 “创建配方”。
您可以使用基础设施配置来指定 Image Builder 用来构建和测试您的映像生成器映像的 Amazon EC2 基础架构。要与 RES 配合使用,您可以选择创建新的基础架构配置,也可以选择使用现有基础架构配置。
要配置 Image Builder 基础设施,请执行以下操作:
-
对于 IAM 角色,请输入您之前在中配置的角色准备一个 IAM 角色以访问 RES 环境。
-
对于实例类型,请选择内存至少 4 GB 且支持所选基本 AMI 架构的类型。参见 Amazon EC2 实例类型。
-
对于 VPC、子网和安全组,您必须允许互联网访问才能下载软件包。还必须允许访问 RES 环境的 cluster-settings DynamoDB 表和 Amazon S3 集群存储桶。
配置 Image Builder 图像管道
Image Builder 映像管道汇集了基础映像、用于构建和测试的组件、基础架构配置和分发设置。要 RES-ready 为 AMI 配置图像管道,您可以选择创建新管道或使用现有管道。有关更多信息,请参阅 Image Builder 用户指南中的创建和更新 AMI 图像管道。
- Create a new Image Builder pipeline
-
- Modify an existing Image Builder pipeline
-
运行 Image Builder 图像管道
要生成配置的输出图像,必须启动图像管道。构建过程可能需要长达一个小时,具体取决于图像配方中组件的数量。
在 RES 中注册新的软件堆栈