This topic describes how to use a lifecycle hook of Auto Scaling to put ECS instances into the wait state and then use an Operation Orchestration Service (OOS) template to automatically add or remove the instances to or from the whitelist of an AnalyticDB for MySQL cluster.
Prerequisites
- An Alibaba Cloud account is created. To create an Alibaba Cloud account, go to the account registration page.
- A scaling group is created and enabled.
- An AnalyticDB for MySQL cluster is created.
- A RAM role is created for OOS. For more information, see Grant RAM permissions for OOS.
Note The OOSServiceRole RAM role is used in this example. You can also use other custom RAM roles, but you must make sure that the used RAM role has the permissions required to execute OOS templates.
Background information
Procedure
- Step 1: Grant OOS permissions to the RAM user
- Step 2: Create a lifecycle hook for scale-out events and trigger a scale-out event
- Step 3: View the whitelist of the AnalyticDB for MySQL cluster
- Step 4: (Optional) View the execution status of the OOS template
Step 1: Grant OOS permissions to the RAM user
You must be granted the permissions to execute OOS templates. Resources of ECS, Auto Scaling, and AnalyticDB for MySQL are involved when the O&M operations specified in the ACS-ESS-LifeCycleModifyAnalyticDBIPWhitelist template are performed.
- Log on to the RAM console.
- Create a policy.
- Attach the policy to the OOSServiceRole RAM role.
Step 2: Create a lifecycle hook for scale-out events and trigger a scale-out event
Step 3: View the whitelist of the AnalyticDB for MySQL cluster
Step 4: (Optional) View the execution status of the OOS template
FAQ
- Error message: Forbidden.Unauthorized message: A required authorization for the specified action
is not supplied.
Solution: Check whether you have granted the required permissions to the OOSServiceRole RAM role, such as the sample permissions in Step 1. You must grant required permissions to the OOSServiceRole RAM role to make sure that OOS can manage the resources involved in OOS templates.
- Error message: Forbidden.RAM message: User not authorized to operate on the specified resource, or
this API doesn't support RAM.
Solution: Check whether you have granted the required permissions to the OOSServiceRole RAM role, such as the sample permissions in Step 1. You must grant required permissions to the OOSServiceRole RAM role to make sure that OOS can manage the resources involved in OOS templates.
- Error message: LifecycleHookIdAndLifecycleActionToken.Invalid message: The specified lifecycleActionToken
and lifecycleActionId you provided does not match any in process lifecycle action.
Solution: Estimate the timeout period of the lifecycle hook to make sure that the O&M task specified in the OOS template can be complete within the timeout period.