本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
設定 RES 就緒 AMIs
使用 RES-ready Amazon Machine Image (AMIs),您可以在自訂 AMI 上預先安裝虛擬桌面執行個體 VDIs) 的 RES AMIs 相依性。使用 RES-ready AMIs 可改善使用預先製作映像的 VDI 執行個體開機時間。使用 EC2 Image Builder,您可以將 AMIs 建置並註冊為新的軟體堆疊。如需映像建置器的詳細資訊,請參閱映像建置器使用者指南。
開始之前,您必須部署最新版本的 RES。
準備 IAM 角色以存取 RES 環境
若要從 EC2 Image Builder 存取 RES 環境服務,您必須建立或修改名為 RES-EC2InstanceProfileForImageBuilder 的 IAM 角色。如需設定 IAM 角色以用於映像建置器的詳細資訊,請參閱《映像建置器使用者指南》中的 AWS Identity and Access Management (IAM)。
建立 EC2 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'
) latest
中的 取代為確切的版本編號 (例如 2025.06
)。
- 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 支援下列映像作業系統:
-
Amazon Linux 2 (x86 和 ARM64)
-
Amazon 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 代理程式,請安裝 SSM 代理程式。在使用者資料和任何其他必要的使用者資料中輸入資訊。
-
對於 Linux 型配方,將 Amazon 受管aws-cli-version-2-linux
建置元件新增至配方。RES 安裝指令碼使用 AWS CLI 提供 DynamoDB 叢集設定組態值的 VDI 存取權。Windows 不需要此元件。
-
新增為 Linux 或 Windows 環境建立的 EC2 Image Builder 元件。
對於 Linux 環境,您必須先新增aws-cli-version-2-linux
建置元件,才能依序新增這些元件。
-
(建議) 新增 Amazon 受管simple-boot-test-<linux-or-windows>
測試元件,以確認可以啟動 AMI。這是最低建議。您可以選取其他符合您需求的測試元件。
-
視需要完成任何選用區段,新增任何其他所需的元件,然後選擇建立配方。
- Modify a recipe
-
如果您有現有的 EC2 Image Builder 配方,您可以新增下列元件來使用它:
-
對於 Linux 型配方,將 Amazon 受管aws-cli-version-2-linux
建置元件新增至配方。RES 安裝指令碼使用 AWS CLI 提供 DynamoDB 叢集設定組態值的 VDI 存取權。Windows 不需要此元件。
-
新增為 Linux 或 Windows 環境建立的 EC2 Image Builder 元件。
對於 Linux 環境,您必須先新增aws-cli-version-2-linux
建置元件,才能依序新增這些元件。
-
視需要完成任何選用區段,新增任何其他所需的元件,然後選擇建立配方。
您可以使用基礎設施組態來指定映像建置器用來建置和測試映像建置器映像的 Amazon EC2 基礎設施。若要搭配 RES 使用,您可以選擇建立新的基礎設施組態,或使用現有的基礎設施組態。
若要設定映像建置器基礎設施:
-
針對 IAM 角色,輸入您先前在 中設定的角色準備 IAM 角色以存取 RES 環境。
-
針對執行個體類型,選擇至少具有 4 GB 記憶體的類型,並支援您選擇的基本 AMI 架構。請參閱 Amazon EC2 執行個體類型。
-
對於 VPC、子網路和安全群組,您必須允許網際網路存取以下載軟體套件。還必須允許存取 RES 環境的 cluster-settings
DynamoDB 資料表和 Amazon S3 叢集儲存貯體。
設定映像建置器映像管道
映像建置器映像管道會組合基礎映像、用於建置和測試的元件、基礎設施組態和分發設定。若要為 RES 就緒 AMIs 設定映像管道,您可以選擇建立新的管道,或使用現有的管道。如需詳細資訊,請參閱《映像建置器使用者指南》中的建立和更新 AMI 映像管道。
- Create a new Image Builder pipeline
-
- Modify an existing Image Builder pipeline
-
執行映像建置器映像管道
若要產生已設定的輸出映像,您必須啟動映像管道。建置程序可能需要長達一小時的時間,具體取決於映像配方中的元件數量。
在 RES 中註冊新的軟體堆疊