本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
配置 RES-ready AMIs
借助 Res-ready Amazon 系统映像 (AMIs),您可以在自定义服务器上预安装虚拟桌面实例 (VDIs) 的 RES 依赖项。 AMIs使用 RES-ready 可以 AMIs 缩短使用预烘焙映像的 VDI 实例的启动时间。使用 EC2 Image Builder,您可以构建自己的软件堆栈并将其注册 AMIs 为新的软件堆栈。有关 Image Builder 的更多信息,请参阅 Image Builder 用户指南。
在开始之前,必须部署最新版本的 RES。
准备一个 IAM 角色以访问 RES 环境
要从 I EC2 mage Builder 访问 RES 环境服务,您必须创建或修改名为 RES-的 IAM 角色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 支持以下镜像操作系统:
-
亚马逊 Linux 2 (x86 和 ARM64)
-
亚马逊 Linux 2023 (x86 和 ARM64)
-
RHEL 8 (x86) 和 9 (x86)
-
Rocky Linux 9 (x86)
-
Ubuntu 22.04.3 (x86)
-
Windows Server 2019、2022 (x86)
-
Windows 10、11 (x86)
- Create a new recipe
-
-
打开 EC2 Image Builder 控制台,网址为https://console.aws.amazon.com/imagebuilder。
-
在 “已保存的资源” 下,选择 “图像配方”。
-
选择创建映像配方。
-
输入唯一的名称和版本号。
-
选择 RES 支持的基础镜像。
-
在 “实例配置” 下,如果未预安装 SSM 代理,请安装。在用户数据和任何其他需要的用户数据中输入信息。
-
对于基于 Linux 的配方,请将亚马逊管理的aws-cli-version-2-linux
构建组件添加到配方中。RES 安装脚本使用提供对 DynamoDB 集群设置配置值的 VDI 访问权限。 AWS CLI Windows 不需要这个组件。
-
添加为你的 Linux 或 Windows 环境创建的 EC2 Image Builder 组件。
对于 Linux 环境,必须按顺序添加这些组件,并先添加aws-cli-version-2-linux
构建组件。
-
(推荐)添加亚马逊管理的simple-boot-test-<linux-or-windows>
测试组件以验证 AMI 是否可以启动。这是最低限度的建议。您可以选择其他符合您要求的测试组件。
-
如果需要,请完成所有可选部分,添加任何其他所需的组件,然后选择 “创建配方”。
- Modify a recipe
-
如果您已有 I EC2 mage Builder 配方,则可以通过添加以下组件来使用它:
-
对于基于 Linux 的配方,请将亚马逊管理的aws-cli-version-2-linux
构建组件添加到配方中。RES 安装脚本使用提供对 DynamoDB 集群设置配置值的 VDI 访问权限。 AWS CLI Windows 不需要这个组件。
-
添加为你的 Linux 或 Windows 环境创建的 EC2 Image Builder 组件。
对于 Linux 环境,必须按顺序添加这些组件,并先添加aws-cli-version-2-linux
构建组件。
-
如果需要,请完成所有可选部分,添加任何其他所需的组件,然后选择 “创建配方”。
您可以使用基础设施配置来指定 Image Builder 用来构建和测试您的 Image Builder 映像的亚马逊 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 AMIs,您可以选择创建新管道或使用现有管道。有关更多信息,请参阅 Image Builder 用户指南中的创建和更新 AMI 图像管道。
- Create a new Image Builder pipeline
-
- Modify an existing Image Builder pipeline
-
运行 Image Builder 图像管道
要生成配置的输出图像,必须启动图像管道。构建过程可能需要长达一个小时,具体取决于图像配方中组件的数量。
在 RES 中注册新的软件堆栈