setInstanceProtection

Updates the instance protection settings of the specified instances. This operation cannot be called on instances in a warm pool.

For more information, see Use instance scale-in protection in the Amazon EC2 Auto Scaling User Guide.

If you exceed your maximum limit of instance IDs, which is 50 per Auto Scaling group, the call fails.

Samples

// This example enables instance protection for the specified instance.
autoScalingClient.setInstanceProtection {
    instanceIds = listOf<String>(
        "i-93633f9b"
    )
    autoScalingGroupName = "my-auto-scaling-group"
    protectedFromScaleIn = true
}
// This example disables instance protection for the specified instance.
autoScalingClient.setInstanceProtection {
    instanceIds = listOf<String>(
        "i-93633f9b"
    )
    autoScalingGroupName = "my-auto-scaling-group"
    protectedFromScaleIn = false
}