This topic describes how to use a lifecycle hook to add ECS instances to or remove them from the whitelist of an ApsaraDB for Redis (Redis) instance.
- Log on to the Auto Scaling console.
- In the top navigation bar, select a region.
- You can use either of the following methods to open the details page of a scaling
- In the Scaling Group Name/ID column, click a scaling group name.
- Click Manage in the Actions column corresponding to a scaling group.
- In the left-side navigation pane, click Lifecycle Hooks.
- Click Create Lifecycle Hook.
- Configure parameters that are related to the whitelist of a Redis instance.
- In the Notification Method section, select OOS Template and then select Public Templates.
- Select ACS-ESS-LifeCycleModifyRedisIPWhitelist from the public template list.
You can enter the keyword redis to search for the template.
- Click Configure Parameters.
- Configure parameters for the OOS template.
Parameter Description dbInstanceId The ID of the Redis instance. modifyMode The specified operation type. It must be the same as that of the scaling activity.
- Append: corresponds to the scale-out event, and specifies that the internal IP addresses of ECS instances are automatically added to the whitelist of the Redis instance.
- Delete: corresponds to the scale-in event, and specifies that the internal IP addresses of ECS instances are automatically removed from the whitelist of the Redis instance.
Permissions The permission to automatically add ECS instances to or remove them from the whitelist of the Redis instance. Default value: OOSServiceRole.
You can create other RAM roles. For more information, see Grant RAM permission for OOS。
- Click OK.
- Configure other required parameters for the lifecycle hook and click Create.
For more information about other required parameters for a lifecycle hook, see Create a lifecycle hook.