CLI로 SetInstanceProtection 사용 - AWS SDK 코드 예제

AWS SDK 예제 GitHub 리포지토리에 더 많은 AWS문서 SDK 예제가 있습니다.

CLI로 SetInstanceProtection 사용

다음 코드 예시는 SetInstanceProtection의 사용 방법을 보여 줍니다.

CLI
AWS CLI

예제 1: 인스턴스의 인스턴스 보호 설정을 활성화하는 방법

이 예제에서는 지정된 인스턴스에 대한 인스턴스 보호를 활성화합니다.

aws autoscaling set-instance-protection \ --instance-ids i-061c63c5eb45f0416 \ --auto-scaling-group-name my-asg --protected-from-scale-in

이 명령은 출력을 생성하지 않습니다.

예제 2: 인스턴스의 인스턴스 보호 설정을 비활성화하는 방법

이 예제에서는 지정된 인스턴스에 대한 인스턴스 보호를 비활성화합니다.

aws autoscaling set-instance-protection \ --instance-ids i-061c63c5eb45f0416 \ --auto-scaling-group-name my-asg \ --no-protected-from-scale-in

이 명령은 출력을 생성하지 않습니다.

PowerShell
Tools for PowerShell V4

예제 1: 이 예제에서는 지정된 인스턴스에 대한 인스턴스 보호를 활성화합니다.

Set-ASInstanceProtection -AutoScalingGroupName my-asg -InstanceId i-12345678 -ProtectedFromScaleIn $true

예제 2: 이 예제에서는 지정된 인스턴스에 대한 인스턴스 보호를 비활성화합니다.

Set-ASInstanceProtection -AutoScalingGroupName my-asg -InstanceId i-12345678 -ProtectedFromScaleIn $false
  • API 세부 정보는 AWS Tools for PowerShell Cmdlet 참조(V4)SetInstanceProtection을 참조하세요.

Tools for PowerShell V5

예제 1: 이 예제에서는 지정된 인스턴스에 대한 인스턴스 보호를 활성화합니다.

Set-ASInstanceProtection -AutoScalingGroupName my-asg -InstanceId i-12345678 -ProtectedFromScaleIn $true

예제 2: 이 예제에서는 지정된 인스턴스에 대한 인스턴스 보호를 비활성화합니다.

Set-ASInstanceProtection -AutoScalingGroupName my-asg -InstanceId i-12345678 -ProtectedFromScaleIn $false
  • API 세부 정보는 AWS Tools for PowerShell Cmdlet 참조(V5)SetInstanceProtection을 참조하세요.