Creates an alias.

Request headers

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

Request syntax

POST /services/{serviceName}/aliases HTTP/1.1

Request parameters

Parameter Type Location Required Example Description
serviceName String Path Yes service_name

The name of the service. The name must be 1 to 128 characters in length and can contain letters, digits, underscores (_), and hyphens (-). The name cannot start with a digit or an underscore and cannot be LATEST.

Object Body No

The definition of the alias.

additionalVersionWeight Map Body No 1

The canary release version to which the alias points and the weight of the canary release version.

  • The canary release version takes effect only when the function is invoked.
  • The value consists of a version number and a specific weight. For example, 2:0.05 indicates that when a function is invoked, Version 2 is the canary release version, 5% of the traffic is distributed to the canary release version, and 95% of the traffic is distributed to the major version.
Float Body No 1

The weight of the traffic. Valid values: 0.0 to 1.0.

aliasName String Body Yes alias_test

The name of the alias. The name must be 1 to 128 characters in length and can contain letters, digits, underscores (_), and hyphens (-). The name cannot start with a digit or an underscore and cannot be LATEST.

description String Body No test_description

The description of the alias. The description can be up to 256 characters in length.

versionId String Body Yes 1

The version to which the alias points.

Response parameters

Parameter Type Example Description
additionalVersionWeight Map

The canary release version to which the alias points and the weight of the canary release version.

  • The canary release version takes effect only when the function is invoked.
  • The value consists of a version number and a specific weight. For example, 2:0.05 indicates that when a function is invoked, Version 2 is the canary release version, 5% of the traffic is distributed to the canary release version, and 95% of the traffic is distributed to the major version.
Float 1

The weight of traffic. Valid values: 0.0 to 1.0.

aliasName String alias_test

The name of the alias.

createdTime String 2020-04-23T06:32:43Z

The time when the alias was created.

description String test_description

The description of the alias.

lastModifiedTime String 2020-04-23T06:32:43Z

The time when the alias was last updated.

serviceName String service_name

The name of the service.

versionId String 1

The version to which the alias points.

Examples

Sample requests

POST /2016-08-15/services/service_name/aliases HTTP/1.1
Common request headers
{
    "aliasName":"alias_test",
    "versionId":"1",
    "description":"test_description"
}

Sample success responses

JSON format

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

HTTP/1.1 200 OK
Common response headers
{
  "aliasName": "alias_test",
  "versionId": "1",
  "description": "test_description",
  "additionalVersionWeight": null,
  "createdTime": "2020-04-23T06:32:43Z",
  "lastModifiedTime": "2020-04-23T06:32:43Z"
}