Function Compute allows you to manage aliases. An alias is a resource used for version management. You can use aliases and versions to implement continuous integration and continuous delivery in the software development lifecycle.
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 to which the alias points. This way, the caller does not need to know the specific version to which the alias points.
Function Compute allows you to create an alias for a service version. An alias points to a specific service version and can be modified. An alias cannot point to other aliases. You can use an alias to publish, roll back, or canary release a version with ease.
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 affects user experience on the client. In contrast, if you use an alias to manage the version, you can hitlessly upgrade the version.
For example, you can set the alias PROD to point to stable Version 1. If a trigger is created for your function, you can associate the trigger with the alias PROD. For more information, see the "Step 2: Use the alias in a trigger (Optional)" section of the Use an alias to switch traffic topic. The client directly uses the alias PROD to invoke the function in the service of Version 1.
After Version 1 is published, you can continue to develop new features over the LATEST version. The client uses an alias to invoke functions in the service of the corresponding version. To publish Version 2, you need only to change the alias PROD to the alias that points to Version 2. When the client invokes functions, Version 2 is parsed out. This way, the version is updated. In addition, you can change the version to which the alias points to an earlier version to roll back the version. For example, you can change the version to which the alias PROD points to a version earlier than Version 1. This way, you can publish a version without frequently updating triggers or deteriorating user experience on the client.
When you create an alias, you must set the parameters that are described in the following table.
|AliasName||Yes||The name of the alias. The name must be unique in the current service and meet the following requirements:
|VersionId||Yes||The version to which the alias points. An alias cannot point to the LATEST version reserved by Function Compute.|
|Description||No||The description of the alias.|
|AdditionalVersionWeight||No||The canary release version to which the alias points and the weight of the canary release version.