Alibaba Cloud Function Compute provides the alias management feature. An alias is a resource used for version management. By using aliases and versions, you can implement continuous integration and continuous delivery in the software development lifecycle.

Definition

As a resource in Function Compute, an alias can be considered as a pointer to a specific service version. An alias is dependent on a service or a version. When you use an alias to access a service or function, Function Compute parses the alias into the version that the alias points to. This frees the caller from needing to know the specific version that the alias points to.

Function Compute allows you to create an alias for a service version. The alias points to a specific service version and can be modified. An alias cannot point to other aliases. You can use an alias to easily publish, roll back, or canary release a version.

Assume that a third party triggers your function by using an HTTP trigger and no aliases are configured for your service. Each time a new service version is published, you must manually modify the version associated with the HTTP trigger, and the modification will affect the user experience on the client. In contrast, if you use an alias to manage the version, you can upgrade the version hitlessly.

For example, you can set alias PROD to point to stable version 1. If a trigger is created for your function, you can associate the trigger with alias PROD. For more information, see Use aliases in triggers. The client directly uses alias PROD to call the function for the service of version 1.

Figure 1. Publish version 1
version1

After version 1 is published, you can continue to develop new features over the LATEST version. In this example, the client calls functions for the service of the corresponding version by using an alias. Therefore, when you need to publish version 2, you only need to change alias PROD to point to version 2. In this way, when the client calls the function, version 2 is parsed out, implementing easy version update. In addition, you can point the alias to an earlier version to roll back the version. For example, you can change alias PROD to point to an earlier version than version 1. In this way, you can publish a version without needing to frequently update triggers or deteriorate the user experience on the client.

Figure 2. Publish version 2
version2

Alias parameters

When you create an alias, you must specify the parameters described in the following table.

Note You can modify all parameters subsequently except AliasName.
Parameter Required Description
AliasName Yes The name of the alias. The alias name must be unique in the current Function Compute service and comply with the following constraints:
  • The name consists of letters, numbers (0-9), underscores (_), and hyphens (-).
  • The name must start with a letter or an underscore (_).
  • The name is case-sensitive.
  • The name must be 1 to 128 characters in length.
  • The alias name cannot be LATEST, which is the default version name reserved by the Function Compute system.
VersionId Yes The version to which the alias points. An alias cannot point to the LATEST version reserved by the system.
Description No The description of the alias.
AdditionalVersionWeight No The additional version to which the alias points and the weight of the additional version.
  • The additional version takes effect only when the function is called.
  • The value consists of a version number and the corresponding weight. For example, 2:0.05 indicates that when a function is called, version 2 is the additional version, 5% of the traffic is distributed to the additional version, and 95% of the traffic is distributed to the major version.