EC2 Launch V2를 사용하여 Sysprep을 진행한 EC2 Windows 인스턴스에 이후 관리자 계정으로 로그인 할 수 없는 경우 해결 방안

3분 분량
콘텐츠 수준: 중급
0

본 기사는 EC Launch V2를 사용하여 Syprep을 진행할 때 관리 계정의 패스워드가 정상적으로 설정되지 못하는 경우의 발생 사례와 이에 대한 해결 방안을 제공합니다.

AWS는 Sysprep을 사용하여 사용자 Windows AMI(Amazon Machine Image)를 만들 때 EC2 Launch V2를 통한 Sysprep 진행을 권장합니다. [1]

 

그리고 EC2 Launch V2를 사용하여 Syprep을 진행하면 그 과정에서 Windows의 관리자 계정(administrator)에 대한 패스워드를 임의 생성하거나 원하는 것으로 설정되도록 할 수 있습니다. [2]  

 

이슈 :

EC2 Launch V2를 사용하여 Sysprep을 진행한 이후에 해당 Windows에 로그인을 시도할 때 관리자 계정에 대해 임의 생성된 패스워드를 EC2 대시보드로 부터 가져올 수 없거나, 지정했던 패스워드를 사용하여 로그인 할 수 없는 경우가 발생될 수 있습니다.

 

 

원인 :

EC2 Launch V2 는 EC2 직렬 콘솔(Serial Console)을 사용하여 다양한 작업을 실행합니다. 그런데 만약 EC2 Launch V2를 사용하여 Sysprep을 진행하는 EC2 Windows 인스턴스가 Nitro 시스템에 구축된 인스턴스 유형이고, EC2 직렬 콘솔(Serial Console)에 대한 활성화된 액세스와 함께 SAC(Special Admin Console) 기능이 설정된 경우, 이러한 EC2 직렬 콘솔 포트가 앞서 SAC에 점유되어 EC2 Launch V2 가 정상적으로 동작할 수 없게 되며 이로 인해 Sysprep 과정에서 EC2 Launch V2에 의한 관리자 계정 패스워드 설정이 진행될 수 없어 이슈가 발생됩니다.

 

이러한 경우 EC2 Launch V2 로그(%ProgramData%\Amazon\EC2Launch\log\agent.log)에서 다음과 같은 메시지를 확인할 수 있습니다.

2023-07-26 08:40:13 Info: EC2Launch Service starting

2023-07-26 08:40:13 Info: Creating Windows event custom log: Amazon EC2Launch

2023-07-26 08:40:13 Info: ACPI SPCR table not supported. Use default console port.

2023-07-26 08:40:13 Info: Serial port is in use. Waiting for Serial Port...

 

해결 방법 :

SAC 기능을 비활성화 하고 EC2 Launch V2를 사용하여 Sysprep을 진행하면 정상적으로 관리자 계정 패스워드를 설정할 수 있습니다. [3]

 

SAC 기능을 비활성화하기 위해서 다음 명령을 실행하여 설정을 변경 합니다. 그리고 변경된 설정 적용을 위해 Windows가 재부팅이 필요합니다. [4]

PowershellCommand prompt
bcdedit /ems '{current}' offbcdedit /ems {current} off

 

EC2 Launch V2를 사용하여 Sysprep을 진행한 이후에 만약 SAC 기능을 다시 활성화 하는 것이 필요하다면 다음 명령을 사용하여 활성화 하실 수 있습니다. 이 경우에도 변경된 설정을 적용하기 위해 Windows 는 재부팅이 필요합니다.

PowershellCommand prompt
bcdedit /ems '{current}' onbcdedit /ems {current} on

 

또는 Sysprep 진행 이후 해당 인스턴스가 다시 시작될 때 SAC 기능이 활성화 되도록 스크립트를 사용자 데이터로 사용하실 수 있습니다. [5]

<powershell>

bcdedit /ems '{current}' on

shutdown -r -t 0

</powershell>

 

 

참고:

[1] Create a standardized Amazon Machine Image (AMI) using Sysprep https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/Creating_EBSbacked_WinAMI.html#ami-create-standard

[2] Change settings using the EC2Launch v2 settings dialog box https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2launch-v2-settings.html#ec2launch-v2-ui

[3] Service stuck in running status https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2launchv2-troubleshooting.html#ec2launchv2-troubleshooting-service-stuck-running

[4] Disable SAC and the boot menu https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/troubleshooting-sac.html#disable-sac-bootmenu

[5] User data and the console https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-windows-user-data.html#user-data-console

profile pictureAWS
지원 엔지니어
게시됨 9달 전289회 조회
댓글 없음

관련 콘텐츠