기능 상태: LA(제한된 가용성)
개요
Horizon Cloud에서 Amazon Core 관리형 인스턴스(CMI)를 사용하려면 지원되는 Windows ISO를 AWS로 가져오고, EC2 Image Builder를 사용하여 기본 AMI를 생성한 다음, EC2 Image Builder 구성 요소, 이미지 레시피 및 파이프라인을 사용하여 HAI(Horizon Agents Installer)로 AMI를 사용자 지정하여 Windows 이미지를 준비해야 합니다.
이 항목에서는 일반적인 준비 단계 및 CMI 전용 이미지 사용자 지정 워크플로를 설명합니다.
참고: 이 방법은 Amazon WorkSpaces Core 방법(방법 1: AWS EC2 사용자 지정 인스턴스 가져오기, 방법 2 및 방법 3)과는 별개입니다. 워크플로가 다르므로 여기에 설명된 단계를 해당 방법과 결합하지 마십시오.
일반적인 준비 단계
CMI용 Windows 이미지를 생성하려면 먼저 다음 준비 작업을 순서대로 완료하십시오. 이러한 단계는 환경, 사용 권한 및 소스 이미지를 AWS EC2 Image Builder와 함께 사용할 준비가 되었는지 확인합니다.
각 단계의 자세한 절차는 Horizon on AWS에 대한 Windows 이미지 생성을 위한 공통 준비 단계를 참조하십시오.
-
Horizon on AWS에 대해 지원되는 Windows ISO 가져오기 - 공식 Microsoft 웹 사이트에서 지원되는 Windows ISO(예: Windows 11 Enterprise 25H2 또는 24H2)를 다운로드합니다.
-
Amazon S3 버킷에 Windows ISO 업로드 - AWS Image Builder에서 액세스할 수 있는 Amazon S3 버킷에 ISO 파일을 업로드합니다. ISO 파일 확장명은 대문자(예:
Windows11.ISO)여야 합니다. -
EC2 Image Builder에 대한 IAM 역할 생성 - 다음 사용 권한 정책을 사용하여 IAM 역할을 생성합니다.
AmazonSSMManagedInstanceCoreEC2InstanceProfileForImageBuilderEC2InstanceProfileForImageBuilderECRContainerBuilds
-
EC2 Image Builder 인프라 구성 생성 - 인스턴스 유형, VPC, 서브넷, 보안 그룹, SNS 주제를 포함하여 이미지 빌드 및 테스트 작업 중에 사용되는 계산, 네트워킹, 알림 설정을 정의합니다.
Windows ISO 가져오기 및 기본 AMI 생성
일반적인 준비 단계를 완료한 후 EC2 Image Builder를 통해 Windows ISO를 AWS로 가져와서 기본 Amazon 시스템 이미지(AMI)를 생성합니다. 생성된 AMI는 나중에 이미지 레시피의 상위 이미지로 사용됩니다.
절차
- AWS 관리 콘솔에서 EC2 Image Builder로 이동합니다.
- 탐색 창에서 이미지를 선택합니다.
- 이미지 가져오기를 선택합니다.
- 일반 섹션에서 다음 정보를 입력합니다.
- 이름 – 이미지의 고유한 이름을 입력합니다.
- 버전 –
major.minor.patch형식을 사용하여 버전 번호를 지정합니다.
- 가져오기 유형에 대해 ISO 가져오기를 선택합니다.
- ISO 가져오기 구성 섹션에서 다음 세부 정보를 입력합니다.
- S3 URI – Windows ISO 파일이 저장되는 Amazon S3 위치를 지정합니다.
- IAM 역할 - 일반적인 준비 단계에서 생성한 IAM 역할을 선택합니다.
- ISO 인프라 구성의 경우, 일반적인 준비 단계에서 생성한 인프라 구성을 선택합니다.
- 이미지 가져오기를 선택하여 ISO 가져오기 프로세스를 시작합니다.
- 이미지 생성이 성공적으로 완료될 때까지 EC2 Image Builder에서 가져오기 상태를 모니터링합니다.
기본 AMI 검증
ISO 가져오기가 완료된 후 계속 진행하기 전에 기본 AMI를 사용할 수 있는지 확인합니다.
- EC2 Image Builder에서 이미지로 이동합니다.
- ISO 가져오기에서 생성된 이미지를 찾습니다.
- 마지막 성공 상태가 사용 가능으로 표시되는지 확인합니다.
Horizon Agents Installer를 사용하여 Windows AMI 사용자 지정
기본 AMI를 생성하고 검증한 후에는 EC2 Image Builder 구성 요소, 이미지 레시피, 이미지 파이프라인을 사용하여 Horizon Agents Installer로 기본 AMI를 사용자 지정합니다. 이 방법을 사용하면 수동 RDP 세션 없이도 사용자 지정을 자동화할 수 있습니다.
1단계: 사용자 지정 EC2 Image Builder 구성 요소 생성
EC2 Image Builder에서 사용자 지정 구성 요소를 생성하여 Horizon Agent 설치 및 OOBE 설정 구성을 자동화합니다. 각 구성 요소는 YAML 문서로 정의됩니다.
사용자 지정 구성 요소를 생성하려면 다음을 수행합니다.
- EC2 Image Builder에서 구성 요소로 이동하여 구성 요소 생성을 클릭합니다.
- 이미지 운영 체제에서 Windows를 선택합니다. OS 버전은 ISO에 의해 결정되므로 지정할 필요가 없습니다.
- KMS 서버는 기본값으로 유지합니다.
- YAML 문서 형식을 사용하여 구성 요소 컨텐츠를 정의합니다.
- 구성 요소 생성을 클릭합니다.
다음 네 가지 구성 요소를 생성합니다. 이러한 구성 요소가 이미지 레시피에 추가되는 순서(다음 단계)가 매우 중요합니다.
구성 요소 1: 사전 설치 RunOnce 백업
모든 HKLM RunOnce 키(64비트 및 Wow6432Node)를 C:\Windows\Temp에 백업한 다음, 모든 RunOnce 값을 제거하여 Horizon Agents Installer가 보류 중인 재부팅(종료 0x643)을 감지하지 않도록 합니다. Horizon Agent 설치 구성 요소 직전에 이 구성 요소를 실행합니다.
# DISCLAIMER:
# This script/YAML file is provided as a sample for reference purposes only.
# It is not intended for production use without proper review, testing, and validation.
# Users are responsible for evaluating and modifying the content to meet their
# security, compliance, and operational requirements.
# No warranties or guarantees are provided.
name: HorizonAgentPreInstallRunOnceBackup
description: Backs up all HKLM RunOnce keys/values (64-bit and Wow6432Node) to C:\Windows\Temp, then removes all RunOnce values so the Horizon Agent installer does not detect a pending reboot (exit 0x643). Run immediately before the Horizon Agent install component.
schemaVersion: 1.0
phases:
- name: build
steps:
- name: ShowRunOnceValues
action: ExecutePowerShell
onFailure: Continue
inputs:
commands:
- |
foreach ($p in 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce',
'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\RunOnce') {
Write-Host "== $p =="
Get-ItemProperty -Path $p -ErrorAction SilentlyContinue | Format-List
}
- name: BackupAllRunOnceKeys
action: ExecutePowerShell
onFailure: Abort
inputs:
commands:
- |
$targets = @(
@{ Reg = 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce'; Ps = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce'; File = 'C:\Windows\Temp\RunOnce_HKLM_backup' },
@{ Reg = 'HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\RunOnce'; Ps = 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\RunOnce'; File = 'C:\Windows\Temp\RunOnce_HKLM_Wow6432Node_backup' }
)
foreach ($t in $targets) {
if (-not (Test-Path $t.Ps)) {
Write-Host "Key not present, skipping: $($t.Reg)"
continue
}
$regFile = "$($t.File).reg"
& reg.exe export $t.Reg $regFile /y
if ($LASTEXITCODE -ne 0) { Write-Error "reg export failed ($LASTEXITCODE) for $($t.Reg)"; exit 1 }
if (-not (Test-Path $regFile)) { Write-Error "Backup file not found: $regFile"; exit 1 }
Write-Host "Backup written to $regFile"
$jsonFile = "$($t.File).json"
$items = @(Get-Item -Path $t.Ps) + @(Get-ChildItem -Path $t.Ps -Recurse -ErrorAction SilentlyContinue)
$rows = foreach ($k in $items) {
foreach ($n in $k.GetValueNames()) {
[pscustomobject]@{
Key = $k.Name
Name = $n
Type = $k.GetValueKind($n).ToString()
Value = $k.GetValue($n, $null, 'DoNotExpandEnvironmentNames')
}
}
}
@($rows) | ConvertTo-Json -Depth 4 | Set-Content -Path $jsonFile -Encoding UTF8
Write-Host "Value inventory written to $jsonFile ($(@($rows).Count) values)"
}
- name: RemoveAllRunOnceValues
action: ExecutePowerShell
onFailure: Abort
inputs:
commands:
- |
# SAFETY: $true = log only (dry run). Set to $false to actually delete.
$DryRun = $false
$roots = @(
'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce',
'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\RunOnce'
)
foreach ($root in $roots) {
if (-not (Test-Path $root)) { Write-Host "Key not present, skipping: $root"; continue }
# Root key plus any subkeys (e.g. RunOnce\Setup). Subkeys themselves are kept; only values are removed.
$keys = @(Get-Item -Path $root) + @(Get-ChildItem -Path $root -Recurse -ErrorAction SilentlyContinue)
foreach ($k in $keys) {
foreach ($n in $k.GetValueNames()) {
if ([string]::IsNullOrEmpty($n)) { continue } # skip (Default)
if ($DryRun) {
Write-Host "[DRY RUN] Would remove '$n' from $($k.Name)"
} else {
Remove-ItemProperty -LiteralPath $k.PSPath -Name $n -ErrorAction Stop
Write-Host "Removed '$n' from $($k.Name)"
}
}
}
}
exit 0
구성 요소 2: Omnissa Horizon Agent 설치
Omnissa Horizon Agents Installer를 다운로드하고 자동으로 설치합니다. 이 설치 관리자는 복원력이 뛰어나 1603 오류가 발생하면 재부팅한 후 최대 2번까지 재시도합니다.
# DISCLAIMER:
# This script/YAML file is provided as a sample for reference purposes only.
# It is not intended for production use without proper review, testing, and validation.
# Users are responsible for evaluating and modifying the content to meet their
# security, compliance, and operational requirements.
# No warranties or guarantees are provided.
name: InstallOmnissaHorizonAgents
description: Downloads and silently installs Omnissa Horizon Agents Installer 26.3.0 (resilient, reboot-and-retry on 1603)
schemaVersion: 1.0
phases:
- name: build
steps:
- name: CheckPendingReboot
action: ExecutePowerShell
onFailure: Continue
inputs:
commands:
- |
$pending = @()
if (Test-Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending') { $pending += 'CBS' }
if (Test-Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired') { $pending += 'WindowsUpdate' }
$pfro = (Get-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager' -Name PendingFileRenameOperations -ErrorAction SilentlyContinue).PendingFileRenameOperations
if ($pfro) { $pending += 'PendingFileRename' }
if ($pending.Count -gt 0) {
Write-Warning "Pending reboot detected ($($pending -join ', ')). Skipping reboot and continuing installation."
} else {
Write-Host "No pending reboot detected."
}
exit 0
- name: DownloadHorizonAgents
action: WebDownload
maxAttempts: 3
timeoutSeconds: 1800
onFailure: Abort
inputs:
- source: https://softwareupdate.omnissa.com/horizoncloud-v2-agents/packages/HAI-Agent/26.3.0/40775428445/Omnissa-Horizon-Agents-Installer-26.3.0-40775428445-x64.exe
destination: C:\Windows\Temp\Omnissa-Horizon-Agents-Installer.exe
overwrite: true
- name: InstallHorizonAgents
action: ExecutePowerShell
maxAttempts: 2
timeoutSeconds: 3600
onFailure: Abort
inputs:
commands:
- |
$ErrorActionPreference = 'Stop'
$installer = 'C:\Windows\Temp\Omnissa-Horizon-Agents-Installer.exe'
$sourceUrl = 'https://softwareupdate.omnissa.com/horizoncloud-v2-agents/packages/HAI-Agent/26.3.0/40775428445/Omnissa-Horizon-Agents-Installer-26.3.0-40775428445-x64.exe'
$log = 'C:\Windows\Temp\HorizonAgents_install_wrapper.log'
$retryFile = 'C:\Windows\Temp\HorizonAgents_1603_retry.txt' # survives reboot
$maxRebootRetries = 2
function Log($m) { "$(Get-Date -Format s) $m" | Out-File $log -Append; Write-Host $m }
$retryCount = 0
if (Test-Path $retryFile) { $retryCount = [int](Get-Content $retryFile -Raw) }
if ($retryCount -gt 0) { Log "Resuming after reboot (1603 retry #$retryCount)." }
# Idempotency check - skipped during 1603 retries (failed installs can leave partial uninstall entries)
if ($retryCount -eq 0) {
$keys = @(
'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*',
'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*'
)
$existing = Get-ItemProperty $keys -ErrorAction SilentlyContinue |
Where-Object { $_.DisplayName -like '*Omnissa Horizon*' }
if ($existing) { Log "Already installed: $($existing.DisplayName -join ', '). Skipping."; exit 0 }
}
# Re-download if installer is missing after reboot
if (-not (Test-Path $installer)) {
Log "Installer missing. Re-downloading..."
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-WebRequest -Uri $sourceUrl -OutFile $installer -UseBasicParsing
if (-not (Test-Path $installer)) { Log "ERROR: Re-download failed."; exit 1 }
}
Log "Starting install..."
$p = Start-Process -FilePath $installer -ArgumentList '/silent','/norestart' -Wait -PassThru
$code = $p.ExitCode
Log "Installer exit code: $code"
switch ($code) {
0 { Remove-Item $retryFile -Force -ErrorAction SilentlyContinue; Log "Install succeeded."; exit 0 }
3010 { Remove-Item $retryFile -Force -ErrorAction SilentlyContinue; Log "Install succeeded; reboot handled by next step."; exit 0 }
1641 { Remove-Item $retryFile -Force -ErrorAction SilentlyContinue; Log "Install succeeded; installer initiated reboot."; exit 0 }
1603 {
if ($retryCount -lt $maxRebootRetries) {
$retryCount++
Set-Content -Path $retryFile -Value $retryCount
Log "1603 received. Rebooting and retrying ($retryCount of $maxRebootRetries)..."
exit 3010 # AWSTOE: reboot the instance, then re-run this step
}
Log "ERROR: 1603 persisted after $maxRebootRetries reboot/retry cycles."
Remove-Item $retryFile -Force -ErrorAction SilentlyContinue
exit 1603
}
default { Log "ERROR: Install failed with exit code $code"; exit $code }
}
- name: RebootAfterInstall
action: Reboot
onFailure: Continue
inputs:
delaySeconds: 30
- name: CleanupInstaller
action: ExecutePowerShell
onFailure: Continue
inputs:
commands:
- |
Remove-Item 'C:\Windows\Temp\Omnissa-Horizon-Agents-Installer.exe' -Force -ErrorAction SilentlyContinue
Remove-Item 'C:\Windows\Temp\HorizonAgents_1603_retry.txt' -Force -ErrorAction SilentlyContinue
exit 0
- name: validate
steps:
- name: VerifyInstallation
action: ExecutePowerShell
onFailure: Continue
inputs:
commands:
- |
$keys = @(
'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*',
'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*'
)
$found = Get-ItemProperty $keys -ErrorAction SilentlyContinue |
Where-Object { $_.DisplayName -like '*Omnissa Horizon*' }
if ($found) {
$found | ForEach-Object { Write-Host "Installed: $($_.DisplayName) $($_.DisplayVersion)" }
} else {
Write-Warning "Omnissa Horizon Agents not found"
}
exit 0
구성 요소 3: 설치 후 RunOnce 복원
사전 설치 백업 구성 요소에서 생성된 C:\Windows\Temp 백업으로부터 모든 HKLM RunOnce 키를 복원하고, 값 인벤토리와 비교하여 확인한 다음 재부팅합니다.
# DISCLAIMER:
# This script/YAML file is provided as a sample for reference purposes only.
# It is not intended for production use without proper review, testing, and validation.
# Users are responsible for evaluating and modifying the content to meet their
# security, compliance, and operational requirements.
# No warranties or guarantees are provided.
name: HorizonAgentPostInstallRunOnceRestore
description: Restores all HKLM RunOnce keys/values (64-bit and Wow6432Node) from the C:\Windows\Temp backups created by HorizonAgentPreInstallRunOnceBackup after the Horizon Agent install, verifies them against the value inventory, then reboots.
schemaVersion: 1.0
phases:
- name: build
steps:
- name: ImportRunOnceBackups
action: ExecutePowerShell
onFailure: Abort
inputs:
commands:
- |
$backups = @(
'C:\Windows\Temp\RunOnce_HKLM_backup.reg',
'C:\Windows\Temp\RunOnce_HKLM_Wow6432Node_backup.reg'
)
$imported = 0
foreach ($b in $backups) {
if (-not (Test-Path $b)) {
# Backup step skips keys that did not exist, so a missing file is not an error
Write-Host "Backup not found, skipping: $b"
continue
}
& reg.exe import $b
if ($LASTEXITCODE -ne 0) { Write-Error "reg import failed ($LASTEXITCODE) for $b"; exit 1 }
Write-Host "Imported $b"
$imported++
}
if ($imported -eq 0) { Write-Error "No RunOnce backup files found in C:\Windows\Temp"; exit 1 }
- name: VerifyRestoredRunOnceValues
action: ExecutePowerShell
onFailure: Continue
inputs:
commands:
- |
$inventories = @(
@{ Json = 'C:\Windows\Temp\RunOnce_HKLM_backup.json' },
@{ Json = 'C:\Windows\Temp\RunOnce_HKLM_Wow6432Node_backup.json' }
)
$missing = 0; $checked = 0
foreach ($i in $inventories) {
if (-not (Test-Path $i.Json)) { Write-Host "Inventory not found, skipping: $($i.Json)"; continue }
$rows = @(Get-Content -Raw -Path $i.Json | ConvertFrom-Json)
foreach ($r in $rows) {
if ($null -eq $r -or [string]::IsNullOrEmpty($r.Name)) { continue }
$checked++
$psKey = 'Registry::' + $r.Key
$cur = Get-ItemProperty -LiteralPath $psKey -Name $r.Name -ErrorAction SilentlyContinue
if ($cur) { Write-Host "Restored: $($r.Key)\$($r.Name)" }
else { Write-Warning "NOT restored: $($r.Key)\$($r.Name)"; $missing++ }
}
}
Write-Host "Checked $checked values; $missing missing"
- name: RebootAfterRestore
action: Reboot
onFailure: Abort
inputs:
delaySeconds: 60
- name: CleanupBackups
action: ExecutePowerShell
onFailure: Continue
inputs:
commands:
- |
Remove-Item -Path 'C:\Windows\Temp\RunOnce_HKLM_backup.reg',
'C:\Windows\Temp\RunOnce_HKLM_backup.json',
'C:\Windows\Temp\RunOnce_HKLM_Wow6432Node_backup.reg',
'C:\Windows\Temp\RunOnce_HKLM_Wow6432Node_backup.json' -Force -ErrorAction SilentlyContinue
Write-Host "Backup files removed"
구성 요소 4: OOBE 무인 설치 구성
EC2Launch v2 Sysprep 무인 설치 파일에 OOBE, UserAccounts, AutoLogon 및 로캘/키보드 설정을 추가하여 설정 중 수동 OS 입력을 방지합니다.
# DISCLAIMER:
# This script/YAML file is provided as a sample for reference purposes only.
# It is not intended for production use without proper review, testing, and validation.
# Users are responsible for evaluating and modifying the content to meet their
# security, compliance, and operational requirements.
# No warranties or guarantees are provided.
name: ConfigureOOBEUnattend
description: Adds OOBE, UserAccounts, AutoLogon and locale/keyboard settings to the EC2Launch v2 Sysprep unattend file
schemaVersion: 1.0
phases:
- name: build
steps:
- name: UpdateEC2LaunchUnattend
action: ExecutePowerShell
onFailure: Abort
inputs:
commands:
- |
$path = 'C:\ProgramData\Amazon\EC2Launch\sysprep\unattend.xml'
if (-not (Test-Path $path)) { Write-Host "ERROR: $path not found"; exit 1 }
Copy-Item $path "$path.bak" -Force
[xml]$xml = Get-Content $path
$uri = 'urn:schemas-microsoft-com:unattend'
$ns = New-Object System.Xml.XmlNamespaceManager($xml.NameTable)
$ns.AddNamespace('u', $uri)
$shell = $xml.SelectSingleNode("//u:settings[@pass='oobeSystem']/u:component[@name='Microsoft-Windows-Shell-Setup']", $ns)
if (-not $shell) { Write-Host "ERROR: oobeSystem Shell-Setup component not found"; exit 1 }
# Create/set a nested element path under a parent, e.g. Set-Node $shell @('OOBE','HideEULAPage') 'true'
function Set-Node($parent, [string[]]$names, [string]$value) {
$cur = $parent
foreach ($name in $names) {
$child = $cur.SelectSingleNode("u:$name", $ns)
if (-not $child) { $child = $xml.CreateElement($name, $uri); [void]$cur.AppendChild($child) }
$cur = $child
}
$cur.InnerText = $value
}
# Random throwaway password generated at build time (never logged, never stored in source).
# EC2Launch resets the Administrator password at instance launch.
$bytes = New-Object byte[] 18
[Security.Cryptography.RandomNumberGenerator]::Create().GetBytes($bytes)
$pw = [Convert]::ToBase64String($bytes) + 'aA1!'
# UserAccounts
Set-Node $shell @('UserAccounts','AdministratorPassword','Value') $pw
Set-Node $shell @('UserAccounts','AdministratorPassword','PlainText') 'true'
# AutoLogon
Set-Node $shell @('AutoLogon','Username') 'Administrator'
Set-Node $shell @('AutoLogon','Enabled') 'true'
Set-Node $shell @('AutoLogon','LogonCount') '1'
Set-Node $shell @('AutoLogon','Password','Value') $pw
Set-Node $shell @('AutoLogon','Password','PlainText') 'true'
# OOBE
$oobe = [ordered]@{
HideEULAPage = 'true'
ProtectYourPC = '3'
HideWirelessSetupInOOBE = 'true'
HideOnlineAccountScreens = 'true'
NetworkLocation = 'Work'
}
foreach ($k in $oobe.Keys) { Set-Node $shell @('OOBE', $k) $oobe[$k] }
# Locale / keyboard (pre-answers the Country, Keyboard layout and Second keyboard OOBE pages)
$settingsNode = $shell.ParentNode
$intl = $settingsNode.SelectSingleNode("u:component[@name='Microsoft-Windows-International-Core']", $ns)
if (-not $intl) {
$intl = $xml.CreateElement('component', $uri)
$attrs = [ordered]@{ name='Microsoft-Windows-International-Core'; processorArchitecture='amd64'; publicKeyToken='31bf3856ad364e35'; language='neutral'; versionScope='nonSxS' }
foreach ($a in $attrs.Keys) { $intl.SetAttribute($a, $attrs[$a]) }
[void]$settingsNode.AppendChild($intl)
}
$locale = [ordered]@{
InputLocale = '0409:00000409' # single US keyboard; no secondary layout page
SystemLocale = 'en-US'
UILanguage = 'en-US'
UserLocale = 'en-US' # sets country/region format
}
foreach ($k in $locale.Keys) { Set-Node $intl @($k) $locale[$k] }
$xml.Save($path)
Write-Host "Updated $path"
- name: validate
steps:
- name: VerifyUnattendSettings
action: ExecutePowerShell
onFailure: Abort
inputs:
commands:
- |
$path = 'C:\ProgramData\Amazon\EC2Launch\sysprep\unattend.xml'
[xml]$xml = Get-Content $path
$ns = New-Object System.Xml.XmlNamespaceManager($xml.NameTable)
$ns.AddNamespace('u', 'urn:schemas-microsoft-com:unattend')
$base = "//u:settings[@pass='oobeSystem']/u:component[@name='Microsoft-Windows-Shell-Setup']"
$ic = "//u:settings[@pass='oobeSystem']/u:component[@name='Microsoft-Windows-International-Core']"
$checks = [ordered]@{
"$base/u:OOBE/u:HideEULAPage" = 'true'
"$base/u:OOBE/u:ProtectYourPC" = '3'
"$base/u:OOBE/u:HideWirelessSetupInOOBE" = 'true'
"$base/u:OOBE/u:HideOnlineAccountScreens" = 'true'
"$base/u:OOBE/u:NetworkLocation" = 'Work'
"$base/u:AutoLogon/u:Username" = 'Administrator'
"$base/u:AutoLogon/u:Enabled" = 'true'
"$base/u:AutoLogon/u:LogonCount" = '1'
"$ic/u:InputLocale" = '0409:00000409'
"$ic/u:SystemLocale" = 'en-US'
"$ic/u:UILanguage" = 'en-US'
"$ic/u:UserLocale" = 'en-US'
}
$failed = $false
foreach ($xp in $checks.Keys) {
$n = $xml.SelectSingleNode($xp, $ns)
if (-not $n -or $n.InnerText -ne $checks[$xp]) { Write-Host "ERROR: missing/incorrect $xp"; $failed = $true }
}
# Presence-only checks for password nodes (values are never printed)
foreach ($xp in @("$base/u:UserAccounts/u:AdministratorPassword/u:Value", "$base/u:AutoLogon/u:Password/u:Value")) {
$n = $xml.SelectSingleNode($xp, $ns)
if (-not $n -or [string]::IsNullOrEmpty($n.InnerText)) { Write-Host "ERROR: missing $xp"; $failed = $true }
}
if ($failed) { exit 1 }
Write-Host "OOBE, UserAccounts, AutoLogon and locale settings present in $path"
2단계: 이미지 레시피 생성
구성 요소를 생성한 후 기본 AMI(ISO 가져오기에서 생성됨)와 사용자 지정 구성 요소를 특정 순서로 결합하는 이미지 레시피를 생성합니다.
이미지를 생성하려면 다음을 수행합니다.
- EC2 Image Builder에서 이미지 레시피로 이동하여 레시피 생성을 클릭합니다.
- ISO 가져오기에서 생성된 이미지를 기본/상위 이미지로 선택합니다.
- 인프라 구성을 선택합니다.
- 다음과 같은 정확한 순서로 빌드 구성 요소를 추가합니다.
| 순서 | 구성 요소 | 용도 |
|---|---|---|
| 1 | HorizonAgentPreInstallRunOnceBackup | HAI 설치 관리자가 보류 중인 재부팅을 감지하지 않도록 RunOnce 키를 백업합니다. |
| 2 | InstallOmnissaHorizonAgents | Omnissa Horizon Agent를 설치합니다. |
| 3 | HorizonAgentPostInstallRunOnceRestore | 백업된 RunOnce 키를 복원합니다. |
| 4 | ConfigureOOBEUnattend | OOBE, 자동 로그온, 로캘 설정 구성 |
- 배포 설정을 선택합니다.
- 레시피 생성을 클릭합니다.
중요: 구성 요소 순서가 매우 중요합니다. 설치 관리자가 보류 중인 재부팅(종료 0x643)을 감지하지 않도록 사전 설치 RunOnce 백업은 HAI 설치 관리자보다 먼저 실행되어야 합니다. HAI 설치 관리자가 백업된 키를 복원한 후에 설치 후 RunOnce 복원을 실행해야 합니다.
3단계: 이미지 파이프라인 생성
이미지 레시피를 생성한 후 구성 요소, 레시피, 인프라 구성을 결합하여 최종 AMI를 생성하는 이미지 파이프라인을 생성합니다.
이미지 파이프라인을 생성하려면 다음을 수행합니다.
- EC2 Image Builder에서 파이프라인으로 이동하여 파이프라인 생성을 클릭합니다.
- 일반 섹션에서 파이프라인의 이름을 입력합니다.
- 실행 유형 선택:
- 수동 - 요청 시 파이프라인을 실행합니다.
- 예약됨 - 스케줄에 따라 파이프라인을 실행합니다.
- 이미지 레시피와 해당 버전을 선택합니다.
- 구성 요소가 올바른 순서(PreInstall RunOnce → HAI → PostInstall RunOnce → OOBE)로 나열되어 있는지 확인합니다.
- 워크플로는 기본값을 그대로 유지합니다.
- 일반적인 준비 단계에서 생성한 인프라 구성을 선택합니다.
- 배포 설정을 구성합니다(기존 항목 사용 또는 새로 생성).
- 파이프라인 생성을 클릭합니다.
파이프라인 워크플로 단계:
- 빌드 - 빌드 인스턴스를 시작하고, SSM 에이전트 준비 상태를 기다린 후, 빌드 구성 요소를 실행하고, 사용자 지정된 인스턴스에서 AMI를 생성한 다음, 빌드 인스턴스를 종료합니다.
- 테스트 - 새 AMI에서 새 인스턴스를 시작하고, 테스트 구성 요소를 실행한 후, 결과를 수집합니다. 테스트가 하나라도 실패하면 이미지가 실패로 표시됩니다.
- 배포(선택 사항) - AMI를 대상 지역에 복사하고 공유 설정을 적용합니다.
파이프라인을 실행하려면 다음을 수행합니다.
- 파이프라인을 선택한 다음 작업 > 파이프라인 실행을 선택합니다.
- 워크플로 엔진은 빌드 → 테스트 → 배포 순으로 오케스트레이션합니다.
- 출력 이미지를 보려면 파이프라인 > 출력 이미지 선택 > 버전을 선택합니다. 출력 리소스 아래에 AMI ID가 표시됩니다.
EC2 Image Builder 파이프라인 구축에 대한 추가 지침은 AWS Builder Center 문서의 Amazon WorkSpaces용 EC2 Image Builder 파이프라인 구축 -- 단계별 가이드를 참조하십시오.
4단계: 이미지 확인 및 Horizon Cloud IMS에 등록
파이프라인이 완료된 후 이미지를 확인하고 CMI 기반 이미지 생성을 위해 Horizon Cloud에 등록합니다.
- EC2 Image Builder에서 파이프라인으로 이동하여 이미지 상태가 사용 가능으로 표시되는지 확인합니다.
- (선택 사항) 생성된 AMI에서 테스트 인스턴스를 시작하여 구성을 확인합니다.
- AMI를 선택하고 AMI에서 인스턴스 시작을 클릭합니다.
- 키 쌍 세부 정보를 제공합니다.
- 인스턴스에 로그인하여 Horizon Agent 및 모든 구성이 올바른지 확인합니다.
- 확인이 완료되면 CMI 기반 이미지 생성을 위해 Horizon Cloud IMS(이미지 관리 서비스)에 AMI를 등록합니다. 자세한 내용은 Horizon Cloud Console 이미지 가져오기 워크플로를 참조하십시오.
참고: Horizon Cloud의 CMI 이미지 등록은 별도로 문서화되어 있습니다. 등록 절차는 AMI를 사용하여 AWS CMI 이미지 등록을 참조하십시오.
관련 참조
이 페이지가 도움이 되었나요?