El contenido no se encuentra disponible en el idioma seleccionado. Estamos trabajando continuamente para agregar más idiomas. Gracias por su apoyo.
- What's New
- Function Overview
- Service Overview
- Getting Started
- User Guide
- Best Practices
-
API Reference
- Before You Start
- API Overview
- Calling APIs
- Getting Started
-
APIs
- AS Groups
- AS Configurations
- Instances
-
AS Policies
- Creating an AS Policy
- Creating an AS Policy (V2)
- Modifying an AS Policy
- Modifying an AS Policy (V2)
- Querying AS Policies Bound to an AS Group
- Querying AS Policies Bound to a Scaling Resource (V2)
- Querying AS Policies (V2)
- Querying an AS Policy
- Querying an AS Policy (V2)
- Executing, Enabling, or Disabling an AS Policy
- Deleting an AS Policy
- Batch Managing AS Policies
- AS Policy Execution Logs
- Scaling Action Logs
- Quotas
- Notifications
- Lifecycle Hooks
- Tags
- Planned Tasks
- API Version Query
- Application Examples
- Permissions and Supported Actions
- Appendix
- Change History
- SDK Reference
-
FAQ
-
General
- What Are Restrictions on Using AS?
- Must I Use AS Together With ELB and Cloud Eye?
- Is AS Billed?
- Will an Abrupt Change in Monitoring Metric Values Trigger an Unnecessary Scaling Action?
- How Many AS Policies and AS Configurations Can I Create and Use?
- Can AS Automatically Scale Up or Down vCPUs, Memory, and Bandwidth of ECSs?
- What Is an AS Quota?
- How Do I Fix the Error "The key pair does not exist" When I Connect to an Instance?
- What Types of EIP and Shared Bandwidths Can Be Adjusted by AS?
- What Types of ECS and HECS Instances Can Be Scaled by AS?
- If the OS of an ECS Instance in an AS Group Is Upgraded, Can AS Automatically Add Instances with the Newest OS During the Next Scale-out Action?
- Can AS Add Yearly/Monthly ECS Instances When It Scales Out an AS Group?
- Can AS Increase Bandwidths as Required?
- AS Group
-
AS Policy
- How Many AS Policies Can I Enable?
- What Are the Conditions to Trigger an Alarm-based AS Policy?
- What Is a Cooldown Period and Why Is It Required?
- Can AS Scale Capacity Based on Custom Monitoring by Cloud Eye?
- What Monitoring Metrics for an AS Group Will Be Affected If VM Tools Are Not Installed on the Instances in the Group?
- What Can I Do If an AS Policy Fails to Be Enabled?
- How Do I Install the Agent on Instances in an AS Group to Use Agent Monitoring Metrics?
-
Instance
- How Do I Prevent Instances Manually Added to an AS Group from Being Automatically Removed?
- When There Are Multiple Flavors Included in the AS Configuration of an AS Group, What Order Are the Flavors Selected in During Scale-out Events?
- When an Instance Is Removed from an AS Group and Deleted, Is the Application Data Saved?
- Can I Add Yearly/Monthly ECS Instances to an AS Group?
- Can the System Automatically Delete the Instances Added Based on an AS Policy When They Are Not Required?
- What Is the Expected Number of Instances?
- How Do I Delete an ECS Instance Created in a Scaling Action?
- Will a Yearly/Monthly ECS Instance Be Deleted If It Becomes Unhealthy?
- How Do I Handle Unhealthy Instances in an AS Group?
- Why Instances in an AS Group Keep Failing Health Checks and Getting Deleted and Recreated?
- How Do I Prevent Instances from Being Automatically Removed from an AS Group?
- Why Is an Instance that Was Removed from an AS Group and Deleted Still Displayed in the ECS List?
- Do I Need to Bind an EIP to an Instance Before I Manually Add the Instance to an AS Group?
- Can I Apply the Configurations of an Existing Instance in an AS Group to Instances to Be Added in the Future?
- Will the System Bind a New EIP or an Existing One a Newly Added ECS Instance?
-
Others
- How Can I Automatically Deploy My Application on an Instance?
- How Does Cloud-Init Affect the AS Service?
- Why Can't I Use a Key File to Log In to an ECS?
- Do I Need to Configure an EIP in an AS Configuration When a Load Balancer Has Been Enabled for an AS Group?
- How Do I Enable Automatic Initialization of EVS Disks on Instances that Have Been Added to an AS Group During Scaling Actions?
-
General
- Videos
- Glossary
-
More Documents
-
User Guide (ME-Abu Dhabi Region)
- Service Overview
- Best Practices
- Quick Start
- AS Management
-
FAQs
-
General
- What Are Restrictions on Using AS?
- Are ELB and Cloud Eye Mandatory for AS?
- Is AS Billed?
- Does an Abrupt Change on Monitoring Indicator Values Cause an Incorrect Scaling Action?
- How Many AS Policies and AS Configurations Can I Create and Use?
- Can AS Automatically Scale Up or Down vCPUs, Memory, and Bandwidth of ECSs?
- What Is the AS Quota?
- Why is a message displayed indicating that the key pair does not exist and the operation is discontinued when several users under the same account operate AS resources?
- AS Group
-
AS Policy
- How Many AS Policies Can Be Enabled?
- What Are the Conditions to Trigger an Alarm in the AS Policy?
- What Is a Cooldown Period? Why Is It Required?
- Can AS Scale Capacity Based on Custom Monitoring of Cloud Eye?
- What Will Monitoring Metrics for an AS Group Be Affected If VM Tools Are Not Installed on ECSs?
- What Can I Do If an AS Policy Fails to Be Enabled?
- How Can I Install the Agent Plug-in on the Instances in an AS Group to Use Agent Monitoring Metrics?
-
Instance
- How Do I Prevent Instances Manually Added to an AS Group from Being Removed Automatically?
- What Are the Sequence of Selecting Flavors in Multi-Flavor AS Configuration?
- Will the Application Data on an Instance Be Retained After the Instance Is Removed from an AS Group and Deleted?
- Can I Add ECSs Charged in Yearly/Monthly Mode?
- Can Instances That Have Been Added Based on an AS Policy Be Automatically Deleted When They Are Not Required?
- What Is the Expected Number of Instances?
- How Do I Delete an ECS Created in a Scaling Action?
- Will a Yearly/Monthly ECS Be Deleted When the ECS Becomes Faulty?
- How Should I Handle Abnormal Instances in an AS Group?
- What Can I Do If Instances in an AS Group Frequently Fail in Health Checks and Are Deleted and Then Created Repeatedly?
- How Do I Prevent ECSs from Being Removed from an AS Group Automatically?
- Why Is an Instance Removed and Deleted from an AS Group Still Displayed in the ECS List?
-
Others
- What Can I Do to Enable My Application to Be Automatically Deployed on an Instance?
- How Does Cloud-Init Affect the AS Service?
- How Can I Run Existing Services on an Instance Newly Added to an AS Group?
- Why Cannot I Use a Key File to Log In to an ECS?
- Do I Need to Configure an EIP in an AS Configuration When A Load Balancer Has Been Enabled in an AS Group?
- How Can I Enable Automatic Initialization of EVS Disks of Instances That Have Been Added in a Scaling Action to an AS Group?
-
General
- Change History
-
API Reference (ME-Abu Dhabi Region)
- Before You Start
- API Overview
- Calling APIs
- Getting Started
-
API
- AS Groups
- AS Configurations
- Instances in an AS Group
-
AS Policies
- Creating an AS Policy
- Creating an AS Policy (V2)
- Modifying an AS Policy
- Modifying an AS Policy (V2)
- Querying AS Policies
- Querying AS Policies (V2)
- Querying All AS Policies (V2)
- Querying AS Policy Details
- Querying Details of an AS Policy (V2)
- Executing, Enabling, or Disabling an AS Policy
- Deleting an AS Policy
- Performing Operations on AS Policies in Batches
- AS Policy Execution Logs
- Scaling Action Logs
- Quotas
- Notifications
- Lifecycle Hook
- Tag Management
- API Management
- Permissions Policies and Supported Actions
- Appendix
- Change History
-
User Guide (Paris Regions)
- Service Overview
- Best Practices
- Quick Start
- AS Management
-
FAQs
-
General
- What Are Restrictions on Using AS?
- Must I Use AS Together With ELB and Cloud Eye?
- Will an Abrupt Change in Monitoring Metric Values Trigger an Unnecessary Scaling Action?
- How Many AS Policies and AS Configurations Can I Create and Use?
- How Do I Fix the Error "The key pair does not exist" When I Connect to an Instance?
- AS Group
-
AS Policy
- How Many AS Policies Can I Enable?
- What Are the Conditions to Trigger an Alarm-based AS Policy?
- What Is a Cooldown Period and Why Is It Required?
- What Monitoring Metrics for an AS Group Will Be Affected If VM Tools Are Not Installed on the Instances in the Group?
- What Can I Do If an AS Policy Fails to Be Enabled?
-
Instance
- How Do I Prevent Instances Manually Added to an AS Group from Being Automatically Removed?
- When an Instance Is Removed from an AS Group and Deleted, Is the Application Data Saved?
- Can AS Automatically Delete Instances Added Based on an AS Policy When They Are Not Required?
- What Is the Expected Number of Instances?
- How Do I Delete an ECS Instance Created in a Scaling Action?
- How Do I Handle Unhealthy Instances in an AS Group?
- Why Instances in an AS Group Keep Failing Health Checks and Getting Deleted and Recreated?
- How Do I Prevent Instances from Being Automatically Removed from an AS Group?
- Why Is an Instance that Was Removed from an AS Group and Deleted Still Displayed in the ECS List?
-
Others
- How Can I Automatically Deploy My Application on an Instance?
- Why Can't I Use a Key File to Log In to an ECS?
- Do I Need to Configure an EIP in an AS Configuration When a Load Balancer Has Been Enabled for an AS Group?
- How Do I Enable Automatic Initialization of EVS Disks on Instances that Have Been Added to an AS Group During Scaling Actions?
-
General
- Change History
- API Reference (Paris Regions)
-
User Guide (Kuala Lumpur Region)
- Service Overview
- Best Practices
- Quick Start
- AS Management
-
FAQs
-
General
- What Are Restrictions on Using AS?
- Must I Use AS Together With ELB and Cloud Eye?
- Is AS Billed?
- Will an Abrupt Change in Monitoring Metric Values Trigger an Unnecessary Scaling Action?
- How Many AS Policies and AS Configurations Can I Create and Use?
- Can AS Automatically Scale Up or Down vCPUs, Memory, and Bandwidth of ECSs?
- What Is an AS Quota?
- How Do I Fix the Error "The key pair does not exist" When I Connect to an Instance?
- AS Group
-
AS Policy
- How Many AS Policies Can I Enable?
- What Are the Conditions to Trigger an Alarm-based AS Policy?
- What Is a Cooldown Period and Why Is It Required?
- Can AS Scale Capacity Based on Custom Monitoring by Cloud Eye?
- What Monitoring Metrics for an AS Group Will Be Affected If VM Tools Are Not Installed on the Instances in the Group?
- What Can I Do If an AS Policy Fails to Be Enabled?
- How Do I Install the Agent on Instances in an AS Group to Use Agent Monitoring Metrics?
-
Instance
- How Do I Prevent Instances Manually Added to an AS Group from Being Automatically Removed?
- When There Are Multiple Flavors Included in the AS Configuration of an AS Group, What Order Are the Flavors Selected in During Scale-out Events?
- When an Instance Is Removed from an AS Group and Deleted, Is the Application Data Saved?
- Can I Add Yearly/Monthly ECS Instances to an AS Group?
- Can the System Automatically Delete the Instances Added Based on an AS Policy When They Are Not Required?
- What Is the Expected Number of Instances?
- How Do I Delete an ECS Instance Created in a Scaling Action?
- Will a Yearly/Monthly ECS Instance Be Deleted If It Becomes Unhealthy?
- How Do I Handle Unhealthy Instances in an AS Group?
- Why Instances in an AS Group Keep Failing Health Checks and Getting Deleted and Recreated?
- How Do I Prevent Instances from Being Automatically Removed from an AS Group?
- Why Is an Instance that Was Removed from an AS Group and Deleted Still Displayed in the ECS List?
-
Others
- How Can I Automatically Deploy My Application on an Instance?
- How Does Cloud-Init Affect the AS Service?
- Why Can't I Use a Key File to Log In to an ECS?
- Do I Need to Configure an EIP in an AS Configuration When a Load Balancer Has Been Enabled for an AS Group?
- How Do I Enable Automatic Initialization of EVS Disks on Instances that Have Been Added to an AS Group During Scaling Actions?
-
General
- Change History
-
API Reference (Kuala Lumpur Region)
- Before You Start
- API Overview
- Calling APIs
- Getting Started
-
APIs
- AS Groups
- AS Configurations
- Instances in an AS Group
-
AS Policies
- Creating an AS Policy
- Creating an AS Policy (V2)
- Modifying an AS Policy
- Modifying an AS Policy (V2)
- Querying AS Policies
- Querying AS Policies (V2)
- Querying All AS Policies (V2)
- Querying AS Policy Details
- Executing, Enabling, or Disabling an AS Policy
- Deleting an AS Policy
- Performing Operations on AS Policies in Batches
- AS Policy Execution Logs
- Scaling Action Logs
- Quotas
- Notifications
- Lifecycle Hook
- Tag Management
- API Management
- Permissions Policies and Supported Actions
- Appendix
- Change History
-
User Guide (Ankara Region)
- Service Overview
- Best Practices
- Quick Start
- AS Management
-
FAQs
-
General
- What Are Restrictions on Using AS?
- Must I Use AS Together With ELB and Cloud Eye?
- Will an Abrupt Change in Monitoring Metric Values Trigger an Unnecessary Scaling Action?
- How Many AS Policies and AS Configurations Can I Create and Use?
- How Do I Fix the Error "The key pair does not exist" When I Connect to an Instance?
- AS Group
-
AS Policy
- How Many AS Policies Can I Enable?
- What Are the Conditions to Trigger an Alarm-based AS Policy?
- What Is a Cooldown Period and Why Is It Required?
- What Monitoring Metrics for an AS Group Will Be Affected If VM Tools Are Not Installed on the Instances in the Group?
- What Can I Do If an AS Policy Fails to Be Enabled?
-
Instance
- How Do I Prevent Instances Manually Added to an AS Group from Being Automatically Removed?
- When an Instance Is Removed from an AS Group and Deleted, Is the Application Data Saved?
- Can AS Automatically Delete Instances Added Based on an AS Policy When They Are Not Required?
- What Is the Expected Number of Instances?
- How Do I Delete an ECS Instance Created in a Scaling Action?
- How Do I Handle Unhealthy Instances in an AS Group?
- Why Instances in an AS Group Keep Failing Health Checks and Getting Deleted and Recreated?
- How Do I Prevent Instances from Being Automatically Removed from an AS Group?
- Why Is an Instance that Was Removed from an AS Group and Deleted Still Displayed in the ECS List?
-
Others
- How Can I Automatically Deploy My Application on an Instance?
- How Does Cloud-Init Affect the AS Service?
- Why Can't I Use a Key File to Log In to an ECS?
- Do I Need to Configure an EIP in an AS Configuration When a Load Balancer Has Been Enabled for an AS Group?
- How Do I Enable Automatic Initialization of EVS Disks on Instances that Have Been Added to an AS Group During Scaling Actions?
-
General
- Change History
-
API Reference (Ankara Region)
- Before You Start
- API Overview
- Calling APIs
- Getting Started
-
APIs
- AS Groups
- AS Configurations
- Instances
-
AS Policies
- Creating an AS Policy
- Creating an AS Policy (V2)
- Modifying an AS Policy
- Modifying an AS Policy (V2)
- Querying AS Policies Bound to an AS Group
- Querying AS Policies Bound to a Scaling Resource (V2)
- Querying AS Policies (V2)
- Querying an AS Policy
- Querying an AS Policy (V2)
- Executing, Enabling, or Disabling an AS Policy
- Deleting an AS Policy
- Batch Managing AS Policies
- AS Policy Execution Logs
- Scaling Action Logs
- Quotas
- Notifications
- Lifecycle Hooks
- API Version Query
- Permissions and Supported Actions
- Appendix
- Change History
-
User Guide (ME-Abu Dhabi Region)
- General Reference
Copied.
Managing Lifecycle Hooks
Lifecycle hooks enable you to flexibly control addition and removal of ECS instances in AS groups and manage the lifecycle of ECS instances in AS groups. Figure 1 shows the instance lifecycle when no lifecycle hook is added to an AS group.
Figure 2 shows the instance lifecycle when a lifecycle hook is added to an AS group.
When the AS group scales in or out, the added lifecycle hooks are triggered, the scaling action is suspended, and the instance being added or removed is put into a wait state, as shown in 2 and 6 in Figure 2. During this period of time, you can perform some custom operations on the instance. For example, you can install or configure software on an instance being added to the AS group. A suspended scaling action will be resumed if either of the following occurs:
- The timeout duration ends.
Assume that you have set the timeout period to 3,600s by referring to section Table 1. The suspended scaling action will be automatically resumed if the timeout duration (3,600s) ends.
- A callback action is performed to move the instance out of the wait state. For details, see Performing a Callback Action.
Application Scenarios
- Instances newly added to an AS group need to be initialized before they are bound to a load balancer listener. Initialization means the software is installed and configured and the instance is fully ready to accept traffic.
- To remove an instance from an AS group, it needs to be first unbound from the load balancer listener, stops accepting new requests, and finishes processing any accepted requests.
- Before instances are removed from an AS group, you may need to back up data or download logs.
- Other scenarios where custom operations need to be performed
How Lifecycle Hooks Work
After you add lifecycle hooks to an AS group, they work as follows:
- Adding an ECS instance to an AS group
When an instance is initialized and added to an AS group, a lifecycle hook of the Instance adding type is automatically triggered. The instance enters the Pending addition state, that is, the instance is suspended by the lifecycle hook. If you have configured a notification object, the system sends a message to the object. After receiving the message, you can perform custom operations, for example, installing software on the instance. The instance remains in a wait state until you complete the custom operations and perform a callback action (see Performing a Callback Action) or the timeout duration ends. After the instance moves out of a wait state, the specified default callback action will take place.
- Continue: The instance will be added to the AS group.
- Abandon: The instance will be deleted and a new instance will be created.
If you have configured multiple Instance adding lifecycle hooks, all of them will be triggered when an instance is added to the AS group. If the default callback action of any lifecycle hook is Abandon, the instance will be deleted and a new instance will be created. If the default callback action of all lifecycle hooks is Continue, the instance is added to the AS group after suspension by the last lifecycle hook is complete.
- Removing an instance from an AS group
When an instance is removed from an AS group, the instance enters the Removing state. After a lifecycle hook is triggered, the instance enters the Pending removal state. The system sends messages to the configured notification object. After receiving the message, you can perform custom operations, such as uninstalling software and backing up data. The instance remains in the wait state until you finish the custom operations and perform the default callback operation or the timeout duration ends. After the instance moves out of a wait state, the specified default callback action will take place.
- Continue: The instance is removed from the AS group.
- Abandon: The instance is removed from the AS group.
If you have configured multiple lifecycle hooks, and the default callback action of all lifecycle hooks is Continue, the instance will be removed from the AS group until suspension by the remaining lifecycle hooks time out. If the default callback action of any lifecycle hook is Abandon, the instance will be directly removed from the AS group.
Constraints
- You can add, modify, or delete a lifecycle hook when the AS group does not perform a scaling action.
- Up to five lifecycle hooks can be added to one AS group.
Adding a Lifecycle Hook
- Log in to the management console.
- Under Computing, click Auto Scaling. Then, on the Auto Scaling page, click the AS Groups tab.
- Click the name of the AS group to which the lifecycle hook is to be added. On the AS group details page, click the Lifecycle Hooks tab and then Add Lifecycle Hook.
- In the displayed Add Lifecycle Hook dialog box, set the parameters listed in Table 1.
Table 1 Parameter description Parameter
Description
Example Value
Hook Name
Specifies the lifecycle hook name. The name can contain letters, digits, underscores (_), and hyphens (-), and cannot exceed 32 characters.
we12_w
Hook Type
Specifies the lifecycle hook type. The value can be Instance adding or Instance removal. Instance adding puts an instance that is being added to an AS group to Pending addition state. Instance removal puts an instance that is being removed from an AS group to Pending removal state.
Instance adding
Default Callback Action
Specifies the action that the system takes when an instance moves out of a wait state.
The default callback action for an Instance adding lifecycle hook can be Continue or Abandon:- Continue: If multiple lifecycle hooks are configured for the AS group, and the default callback action of all the hooks is Continue, the system will continue to add the instance to the AS group until the all lifecycle hooks time out.
- Abandon: If multiple lifecycle hooks are configured for the AS group, and the default callback action of one lifecycle hook is Abandon, the system will delete the instance and create another one without waiting for the remaining lifecycle hooks to time out.
The default callback action for an Instance removal lifecycle hook can be Continue or Abandon:- Continue: If only one lifecycle hook is configured for the AS group, the system will remove the instance from the AS group. If multiple lifecycle hooks are configured for the AS group, and the default callback actions of all the hooks are Continue, the system will continue to remove the instance from the AS group until all lifecycle hooks time out.
- Abandon: If multiple lifecycle hooks are configured for the AS group, and the default callback action of one lifecycle hook is Abandon, the system will continue to remove the instance from the AS group without waiting for the remaining lifecycle hooks to time out.
Continue
Timeout Duration (s)
Specifies the amount of time for the instances to remain in a wait state. The value ranges from 60s to 86,400s.
You can extend the timeout duration or perform a Continue or Abandon action before the timeout duration ends. For more information about callback actions, see Performing a Callback Action.
3600
Notification Topic
Specifies a notification object for a lifecycle hook. For details, see "Creating a Topic" in Simple Message Notification User Guide. When an instance is suspended by the lifecycle hook, the system sends a notification to the object. This notification contains the basic instance information, your custom notification content, and the token for controlling lifecycle actions. An example notification is as follows:
{ "service": "AutoScaling", "tenant_id": "93075aa73f6a4fc0a3209490cc57181a", "lifecycle_hook_type": "INSTANCE_LAUNCHING", "lifecycle_hook_name": "test02", "lifecycle_action_key": "4c76c562-9688-45c6-b685-7fd732df310a", "notification_metadata": "xxxxxxxxxxxxx", "scaling_instance": { "instance_id": "89b421e4-5fa6-4733-bf40-6b07a8657256", "instance_name": "as-config-kxeg_RM6OCREY", "instance_ip": "192.168.0.202" }, "scaling_group": { "scaling_group_id": "fe376277-50a6-4e36-bdb0-685da85f1a82", "scaling_group_name": "as-group-wyz01", "scaling_config_id": "16ca8027-b6cc-45fc-af2d-5a79996f685d", "scaling_config_name": "as-config-kxeg" } }
N/A
Notification Message
After a notification object is configured, the system sends your custom notification to the object.
N/A
- Click OK.
The added lifecycle hook is displayed on the Lifecycle Hooks page.
Performing a Callback Action
- On the AS Groups page, click the name of the target AS group.
- On the displayed page, click the Instances tab.
- Locate the instance that has been suspended by the lifecycle hook and click Pending addition or Pending removal in the Lifecycle Status column.
NOTE:
Callback actions can only be performed on instances that have been suspended by a lifecycle hook.
- In the displayed Added Hook dialog box, view the suspended instance and all the lifecycle hooks, and perform callback actions on lifecycle hooks.
Callback actions include:
- Continue
- Abandon
- Extend timeout
If you have performed custom operations before the timeout duration ends, select Continue or Abandon to complete the lifecycle actions. For details about Continue and Abandon, see Table 1. If you need more time for custom operations, select Extend timeout to extend the timeout duration. Then, the timeout duration will be extended by 3600 seconds each time.
Modifying a Lifecycle Hook
On the Lifecycle Hooks page, locate the target lifecycle hook and click Modify in the Operation column, see Table 1 for parameters. You can modify the parameter except Hook Name, such as Hook Type, Default Callback Action, and Timeout Duration.
Deleting a Lifecycle Hook
On the Lifecycle Hooks page, locate the target lifecycle hook and click Delete in the Operation column.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot