AWS: Enable or Disable Instance Protection in an ASG
Availability
This workflow action is available only to customers on PagerDuty Operations Cloud plans. See Operations Cloud pricing for more information.
Description
Enable or disable "Protected from scale-in" on selected instances in an Auto Scaling Group (ASG). When protection is enabled, the ASG will not terminate these instances during scale-in events, which is useful when you are about to move an instance to Standby or terminate it in a controlled way. This action is useful for:
- Protecting an instance from scale-in before rotating it out of the ASG (e.g., before Enter Standby and Terminate)
- Ensuring a specific instance is not chosen for termination during automatic scale-in
- Building runbooks that combine with Describe Auto Scaling Instances, Enter Standby, and Terminate Instance in Auto Scaling Group for safe instance rotation
- Temporarily shielding instances during maintenance or troubleshooting
Instructions
- If you have not done so, follow the instructions to Create an Incident Workflow.
- When the instructions prompt you to add actions, select this action.
- Enter the following Inputs and click Save.
- Continue following instructions to Publish the Workflow.
- When the action runs, you will see the Outputs listed below.
Inputs
Field References
Fields with the {+} icon accept Field References, which can be useful for referencing incident data or outputs created in prior workflow steps. To add Field References, click {+}, or enter
{{, and select relevant fields. Refer to the Field References article for more information.
| Name | Description |
|---|---|
| Integration | Select a Workflow Integration or click New AWS Connection to establish a new one. |
| Auto Scaling Group Name | The name of the Auto Scaling Group that contains the instances. |
| Instance IDs | One or more EC2 instance IDs to set or clear protection for (comma-separated). Can be from a prior step (e.g., Describe Auto Scaling Instances) or from incident custom details. |
| AWS Region | The AWS region where the ASG is located. If left blank, the action uses us-east-1 as the default. |
| Protected From Scale In | Set to true to protect the instances from scale-in (recommended before rotating an instance out). Set to false to remove protection. |
Outputs
| Name | Description |
|---|---|
| ASG Name | The Auto Scaling Group that was targeted. |
| Protected | Array of instance IDs that were set to the requested protection state. |
| Protected From Scale In | The protection value that was applied (true or false). |
| Result | Whether the action succeeded: Success or Failed. |
| Result Summary | Brief description of what the action did or if it failed. |
| Error | Error message, if the action failed. |
Tips
- Instance Rotation: In a rotate-instance runbook, set Protected From Scale In = true before Enter Standby so the ASG does not select this instance for scale-in while you are rotating it out.
- Chaining Actions: Use Auto Scaling Group Name and Instance IDs from Auto Scaling: Describe Auto Scaling Instances (e.g.,
instances[0].asgName, and the same instance IDs) so the workflow works when the incident only provides an instance ID.
Updated about 2 hours ago
