Create a scheduled task
Creates a scheduled task that triggers a scaling rule on a one-time or recurring schedule. Call the CreateScheduledTask API operation.
Prerequisites
Before you begin, ensure that you have:
An Alibaba Cloud account with a valid AccessKey pair for API authentication. For details on common request parameters such as
AccessKeyIdandSignature, see Common parameters.A scaling group. Record the scaling group ID — for example,
asg-bp18p2yfxow2dloq****.A scaling rule in the scaling group. Record the Alibaba Cloud Resource Identifier (ARN) of the scaling rule — for example,
ari:acs:ess:cn-hangzhou:140692647****:scalingrule/asr-bp12tcnol686y1ik****.
Request parameters
The following table describes the key parameters. For the full parameter list, see CreateScheduledTask.
|
Parameter |
Type |
Required |
Description |
|
|
String |
Yes |
The API operation name. Set to |
|
|
String |
Yes |
The region of the scheduled task. Example: |
|
|
String |
Yes |
The time at which the scheduled task triggers. Use ISO 8601 format: |
|
|
String |
No |
The ARN of the scaling rule to run when the task triggers. Example: |
|
|
String |
No |
The name of the scheduled task. Example: |
|
|
String |
No |
The ID of the scaling group. If specified, you must also specify at least one of |
|
|
String |
No |
The recurrence type. Valid values: |
|
|
String |
No |
The recurrence value. The format depends on |
|
|
String |
No |
The end time of the recurrence. Use ISO 8601 format: |
You must specify eitherScheduledActionorScalingGroupIdin the request. These two parameters are mutually exclusive.
TheRecurrenceTypeandRecurrenceValueparameters must be set together. If you set one, you must set the other.
Sample request
The following example creates a scheduled task that triggers a scaling rule every day at 16:52 UTC, starting on 2014-08-17 and ending at 2014-08-17T16:55Z.
http(s)://ess.aliyuncs.com/?Action=CreateScheduledTask
&RegionId=cn-qingdao
&ScheduledTaskName=scheduled****
&ScheduledAction=ari:acs:ess:cn-hangzhou:140692647****:scalingrule/asr-bp12tcnol686y1ik****
&RecurrenceEndTime=2014-08-17T16:55Z
&LaunchTime=2014-08-17T16:52Z
&RecurrenceType=Daily
&RecurrenceValue=1
&ScalingGroupId=asg-bp18p2yfxow2dloq****
&<Common request parameters>
Sample success responses
A successful response returns the ScheduledTaskId of the created task and a RequestId for troubleshooting.
XML format
HTTP/1.1 200 OK
Content-Type:application/xml
<CreateScheduledTaskResponse>
<ScheduledTaskId>edRtShc57WGXdt8TlPbr****</ScheduledTaskId>
<RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3****</RequestId>
</CreateScheduledTaskResponse>
JSON format
HTTP/1.1 200 OK
Content-Type:application/json
{
"ScheduledTaskId" : "edRtShc57WGXdt8TlPbr****",
"RequestId" : "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****"
}
Related API operations
|
API |
Description |
|
Creates a scheduled task. |
|
|
DescribeScheduledTasks |
Queries scheduled tasks. |
|
ModifyScheduledTask |
Modifies a scheduled task. |
|
DeleteScheduledTask |
Deletes a scheduled task. |