Sets a provisioned configuration.

Background information

You can use provisioned instances to respond to function invocation requests. This reduces the occurrences of cold starts and improves the response speed for latency-sensitive online services. You can perform scheduled auto scaling or metric tracking auto scaling to make better use of provisioned instances. For more information, see Auto-scaling of reserved instances.

Request headers

This operation uses only common request headers. For more information, see Common parameters.

Request syntax

PUT /services/{serviceName.[qualifier]}/functions/{functionName}/provision-config HTTP/1.1

Request parameters

Parameter Type Position Required Example Description
serviceName String Path Yes service_name

The name of the service.

qualifier String Path Yes test

The version or alias of the service.

functionName String Path Yes function_name

The name of the function.

Object Body Yes

The definition of the function.

target Long Body Yes 15

The expected number of provisioned instances.

scheduledActions Array Body No

The configuration of scheduled auto scaling. You can perform scheduled auto scaling to flexibly configure provisioned instances. You can configure the number of provisioned instances to be automatically adjusted to a specified value at a specified time. This way, the number of provisioned instances can meet the concurrency of your business.

name String Body No demoScheduler

The name of the scheduled task.

startTime String Body No 2020-10-10T10:10:10Z

The time when the configuration of scheduled auto scaling starts to take effect.

endTime String Body No 2020-12-10T10:10:10Z

The time when the configuration of scheduled auto scaling expires.

target Long Body No 10

The expected number of provisioned instances.

scheduleExpression String Body No cron(0 30 8 * * *)

The scheduled expression that specifies when to run the scheduled task. Two formats are supported. For more information, see the Parameters table in the "Scheduled auto-scaling" section of the Auto-scaling of reserved instances topic.

targetTrackingPolicies Array Body No

The configuration of metric tracking auto scaling. Provisioned instances are scaled in or out every minute based on the concurrency utilization of provisioned instances.

  • When the metric value exceeds the value of the metricTarget parameter, the system scales out provisioned instances based on a progressive policy to make the metric value near the value of the metricTarget parameter.
  • When the metric value is smaller than the value of the metricTarget parameter, the system scales in provisioned instances based on a conservative policy to make the metric value near the value of the metricTarget parameter.

If you specify the maximum and minimum numbers of provisioned instances, the system scales provisioned instances within the range from the minimum number to the maximum number. If the number of provisioned instances is beyond the range, scaling stops.

name String Body No demoTargetTracking

The name of the scheduled task.

startTime String Body No 2020-10-10T10:10:10Z

The time when the configuration of metric tracking auto scaling starts to take effect.

endTime String Body No 2020-12-10T10:10:10Z

The time when the configuration of metric tracking auto scaling expires.

metricType String Body No ProvisionedConcurrencyUtilization

The type of the metric to be tracked.

metricTarget double Body No 0.6

The expected value of the metric.

minCapacity Long Body No 10

The minimum number of provisioned instances for scale-in.

maxCapacity Long Body No 100

The maximum number of provisioned instances for scale-out.

Response parameters

Parameter Type Example Description
resource String 19861144****3057#service_name#test#function_name

The description of the resource.

target Long 15

The expected number of provisioned instances.

current Long 1

The actual number of instances.

scheduledActions Array

The configuration of scheduled auto scaling. You can perform scheduled auto scaling to flexibly configure provisioned instances. You can configure the number of provisioned instances to be automatically adjusted to a specified value at a specified time. This way, the number of provisioned instances can meet the concurrency of your business.

name String demoScheduler

The name of the scheduled task.

startTime String 2020-10-10T10:10:10Z

The time when the configuration of scheduled auto scaling starts to take effect.

endTime String 2020-12-10T10:10:10Z

The time when the configuration of scheduled auto scaling expires.

target Long 5

The expected number of provisioned instances.

scheduleExpression String cron(0 30 8 * * *)

The scheduled expression that specifies when to run the scheduled task. Two formats are supported. For more information, see the Parameters table in the "Scheduled auto-scaling" section of the Auto-scaling of reserved instances topic.

targetTrackingPolicies Array

The configuration of metric tracking auto scaling. Provisioned instances are scaled in or out every minute based on the concurrency utilization of provisioned instances.

  • When the metric value exceeds the value of the metricTarget parameter, the system scales out provisioned instances based on a progressive policy to make the metric value near the value of the metricTarget parameter.
  • When the metric value is smaller than the value of the metricTarget parameter, the system scales in provisioned instances based on a conservative policy to make the metric value near the value of the metricTarget parameter.

If you specify the maximum and minimum numbers of provisioned instances, the system scales provisioned instances within the range from the minimum number to the maximum number. If the number of provisioned instances is beyond the range, scaling stops.

name String demoTargetTracking

The name of the scheduled task.

startTime String 2020-10-10T10:10:10Z

The time when the configuration of metric tracking auto scaling starts to take effect.

endTime String 2020-12-10T10:10:10Z

The time when the configuration of metric tracking auto scaling expires.

metricType String ProvisionedConcurrencyUtilization

The type of the metric to be tracked.

metricTarget double 0.6

The expected value of the metric.

minCapacity Long 10

The minimum number of provisioned instances for scale-in.

maxCapacity Long 100

The maximum number of provisioned instances for scale-out.

Examples

Sample requests

PUT /2016-08-15/services/service_name.test/functions/function_name/provision-config HTTP/1.1 
Common request headers
{
    "scheduledActions":[
        {
            "endTime":"2020-12-10T10:10:10Z",
            "name":"demoScheduler",
            "scheduleExpression":"cron(0 30 8 * * *)",
            "startTime":"2020-10-10T10:10:10Z",
            "target":5
        }
    ],
    "target":15,
    "targetTrackingPolicies":[
        {
            "endTime":"2020-12-10T10:10:10Z",
            "maxCapacity":100,
            "metricTarget":0.6,
            "metricType":"ProvisionedConcurrencyUtilization",
            "minCapacity":10,
            "name":"demoScheduler",
            "startTime":"2020-10-10T10:10:10Z"
        }
    ]
}

Sample success responses

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "current" : "1",
  "resource" : "19861144****3057#service_name#test#function_name",
  "scheduledActions" : [ {
    "endTime" : "2020-12-10T10:10:10Z",
    "name" : "demoScheduler",
    "scheduleExpression" : "cron(0 30 8 * * *)",
    "startTime" : "2020-10-10T10:10:10Z",
    "target" : 5
  } ],
  "target" : 15,
  "targetTrackingPolicies" : [ {
    "endTime" : "2020-12-10T10:10:10Z",
    "maxCapacity" : 100,
    "metricTarget" : 0.6,
    "metricType" : "ProvisionedConcurrencyUtilization",
    "minCapacity" : 10,
    "name" : "demoScheduler",
    "startTime" : "2020-10-10T10:10:10Z"
  } ]
}