All Products
Search
Document Center

:CreateAlias

Last Updated:Sep 09, 2026

Creates an alias.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

fc:CreateAlias

create

*All Resource

*

None None

Request syntax

POST /2021-04-06/services/{serviceName}/aliases HTTP/1.1

Path Parameters

Parameter

Type

Required

Description

Example

serviceName

string

Yes

The name of the service.

service_name

Request parameters

Parameter

Type

Required

Description

Example

body

object

No

The definition of the alias.

additionalVersionWeight

object

No

The canary release version and the corresponding weight that the alias points to.

  • The canary release version takes effect only when a function is invoked.

  • The value consists of a version number and the corresponding weight. For example, 2:0.05 indicates that when the function is invoked, version 2 is the canary release version, 5% of the traffic is routed to the canary release version, and 95% of the traffic is routed to the primary version by default.

number

No

The traffic weight. Valid values: [0,1].

1

aliasName

string

Yes

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

alias_test

description

string

No

The description of the alias.

test_description

versionId

string

Yes

The version ID that the alias points to.

1

resolvePolicy

string

No

The canary release mode. Valid values:

  • Random: random canary release.

  • Content: rule-based canary release. Default value: none.

Random

routePolicy RoutePolicy

No

The canary release rule. Traffic that meets the canary release rule is routed to the canary release instance.

X-Fc-Account-Id

string

No

The ID of your Alibaba Cloud account.

188077086902****

X-Fc-Date

string

No

The start date when the function is invoked. The format is EEE,d MMM yyyy HH:mm:ss GMT.

Wed, 11 May 2022 09:00:00 GMT

X-Fc-Trace-Id

string

No

The trace ID of the Function Compute invocation request.

r9s89isisi****

Response elements

Element

Type

Description

Example

object

The definition of the alias.

additionalVersionWeight

object

The canary release version and the corresponding weight that the alias points to.

  • The canary release version takes effect only when a function is invoked.

  • The value consists of a version number and the corresponding weight. For example, 2:0.05 indicates that when the function is invoked, version 2 is the canary release version, 5% of the traffic is routed to the canary release version, and 95% of the traffic is routed to the primary version by default.

number

The traffic weight. Valid values: [0,1].

1

aliasName

string

The name of the alias.

alias_test

createdTime

string

The time when the alias was created.

2020-04-23T06:32:43Z

description

string

The description of the alias.

test_description

lastModifiedTime

string

The time when the alias was last updated.

2020-04-23T06:32:43Z

versionId

string

The version ID that the alias points to.

1

resolvePolicy

string

The canary release mode. Valid values:

  • Random: random canary release. This is the default value.

  • Content: rule-based canary release.

Random

routePolicy RoutePolicy

The canary release rule. Traffic that meets the canary release rule is routed to the canary release instance.

Examples

Success response

JSON format

{
  "additionalVersionWeight": {
    "key": 1
  },
  "aliasName": "alias_test",
  "createdTime": "2020-04-23T06:32:43Z",
  "description": "test_description",
  "lastModifiedTime": "2020-04-23T06:32:43Z",
  "versionId": "1",
  "resolvePolicy": "Random",
  "routePolicy": {
    "condition": "AND",
    "policyItems": [
      {
        "type": "Header",
        "key": "x-test-uid",
        "value": "11111",
        "operator": "="
      }
    ]
  }
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.