Systems Manager Run Command에서 EC2Rescue for Windows Server 사용 - Amazon Elastic Compute Cloud

Systems Manager Run Command에서 EC2Rescue for Windows Server 사용

AWS Support는 Systems Manager 사용 인스턴스에서 EC2Rescue for Windows Server를 실행할 때 인터페이스로 사용할 수 있는 Systems Manager Run Command 문서를 제공합니다. 이 Run Command 문서를 AWSSupport-RunEC2RescueForWindowsTool이라고 합니다.

이 Systems Manager Run Command 문서는 다음의 작업을 수행합니다.

  • EC2Rescue for Windows Server를 다운로드하고 확인합니다.

  • 간편하게 도구와 상호 작용하도록 PowerShell 모듈을 가져옵니다.

  • 제공된 명령 및 파라미터를 사용하여 EC2RescueCmd를 실행합니다.

Systems Manager Run Command 문서는 세 가지 파라미터를 수락합니다.

  • 명령—EC2Rescue for Windows Server 작업. 현재 허용되는 값은 다음과 같습니다.

    • ResetAccess — 로컬 관리자 암호를 재설정합니다. 현재 인스턴스의 로컬 관리자 암호가 재설정되고 임의로 생성된 암호가 Parameter Store에 /EC2Rescue/Password/<INSTANCE_ID>로 안전하게 저장됩니다. 이 작업을 선택하고 파라미터를 제공하지 않으면 기본 KMS 키을(를) 사용하여 암호가 자동으로 암호화됩니다. 선택 사항으로, 파라미터에서 KMS 키 ID를 지정하여 고유의 키로 암호를 암호화할 수 있습니다.

    • CollectLogs/collect:all 작업으로 EC2Rescue for Windows Server를 실행합니다. 이 작업을 선택할 경우 로그를 업로드할 Amazon S3 버킷 이름이 Parameters에 포함되어 있어야 합니다.

    • FixAll/rescue:all 작업으로 EC2Rescue for Windows Server를 실행합니다. 이 작업을 선택할 경우 Parameters에 복구할 블록 디바이스 이름이 포함되어야 합니다.

  • 파라미터 — 지정된 명령에 대해 전달할 PowerShell 파라미터입니다.

참고

ResetAccess 작업이 작동하려면 암호화된 암호를 Parameter Store에 쓸 수 있도록 Amazon EC2 인스턴스에 다음 정책을 연결해야 합니다. 이 정책을 관련 IAM 역할에 연결하고 나서 몇 분 기다렸다가 인스턴스의 암호를 재설정하세요.

기본 KMS 키 사용:

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "ssm:PutParameter" ], "Resource": [ "arn:aws:ssm:region:account_id:parameter/EC2Rescue/Passwords/<instanceid>" ] } ] }

사용자 지정 KMS 키 사용:

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "ssm:PutParameter" ], "Resource": [ "arn:aws:ssm:region:account_id:parameter/EC2Rescue/Passwords/<instanceid>" ] }, { "Effect": "Allow", "Action": [ "kms:Encrypt" ], "Resource": [ "arn:aws:kms:region:account_id:key/<kmskeyid>" ] } ] }

다음 절차는 Amazon EC2 콘솔에서 이 문서의 JSON을 보는 방법을 설명합니다.

Systems Manager Run Command 문서의 JSON을 보려면
  1. https://console.aws.amazon.com/systems-manager/home에서 Systems Manager 콘솔을 엽니다.

  2. 탐색 창에서 공유 서비스(Shared Services)를 확장한 다음 문서를 선택합니다.

  3. 검색 창에서 소유자내 소유 또는 Amazon 소유로 설정하고 문서 이름 접두사(Document name prefix)AWSSupport-RunEC2RescueForWindowsTool로 설정합니다.

  4. AWSSupport-RunEC2RescueForWindowsTool 문서를 선택하고 콘텐츠(Contents)를 선택하여 JSON을 봅니다.

예제

다음은 Systems Manager Run Command 문서를 사용하여 AWS CLI에서 EC2Rescue for Windows Server를 실행하는 몇 가지 예제입니다. AWS CLI를 사용한 명령 전송에 대한 자세한 내용은 AWS CLI 명령 참조를 참조하세요.

오프라인 루트 볼륨에서 식별된 모든 문제 해결 시도

다음과 같이 Amazon EC2 Windows 인스턴스에 연결된 오프라인 루트 볼륨에서 식별된 문제를 모두 해결하려고 시도합니다.

aws ssm send-command --instance-ids "i-0cb2b964d3e14fd9f" --document-name "AWSSupport-RunEC2RescueForWindowsTool" --comment "EC2Rescue offline volume xvdf" --parameters "Command=FixAll, Parameters='xvdf'" --output text

현재 Amazon EC2 Windows 인스턴스에서 로그 수집

다음과 같이 현재 온라인 Amazon EC2 Windows 인스턴스에서 모든 로그를 수집하여 Amazon S3 버킷으로 업로드합니다.

aws ssm send-command --instance-ids "i-0cb2b964d3e14fd9f" --document-name "AWSSupport-RunEC2RescueForWindowsTool" --comment "EC2Rescue online log collection to S3" --parameters "Command=CollectLogs, Parameters='YOURS3BUCKETNAME'" --output text

오프라인 Amazon EC2 Windows 인스턴스 볼륨에서 로그 수집

Amazon EC2 Windows 인스턴스에 연결된 오프라인 볼륨에서 로그를 수집하여 미리 서명된 URL을 사용해 Amazon S3로 업로드합니다.

aws ssm send-command --instance-ids "i-0cb2b964d3e14fd9f" --document-name "AWSSupport-RunEC2RescueForWindowsTool" --comment "EC2Rescue offline log collection to S3" --parameters "Command=CollectLogs, Parameters=\"-Offline -BlockDeviceName xvdf -S3PreSignedUrl 'YOURS3PRESIGNEDURL'\"" --output text

로컬 관리자 암호 재설정

다음 예제에서는 로컬 관리자 암호를 재설정하는 데 사용할 수 있는 방법을 보여 줍니다. 출력에는 Parameter Store에 대한 링크가 제공됩니다.여기에서 임의로 생성된 보안 암호를 찾은 다음 이 암호를 사용하여 RDP를 통해 Amazon EC2 Windows 인스턴스에 로컬 관리자로 연결할 수 있습니다.

기본 AWS KMS key alias/aws/ssm을 사용하여 온라인 인스턴스의 로컬 관리자 암호를 재설정합니다.

aws ssm send-command --instance-ids "i-0cb2b964d3e14fd9f" --document-name "AWSSupport-RunEC2RescueForWindowsTool" --comment "EC2Rescue online password reset" --parameters "Command=ResetAccess" --output text

KMS 키을(를) 사용하여 온라인 인스턴스의 로컬 관리자 암호를 재설정합니다.

aws ssm send-command --instance-ids "i-0cb2b964d3e14fd9f" --document-name "AWSSupport-RunEC2RescueForWindowsTool" --comment "EC2Rescue online password reset" --parameters "Command=ResetAccess, Parameters=a133dc3c-a2g4-4fc6-a873-6c0720104bf0" --output text
참고

이 예시에서 KMS 키는 a133dc3c-a2g4-4fc6-a873-6c0720104bf0입니다.