Function Compute support for creating aliases for service versions. Combine alias and version features
to enable continuous integration and release in the software development lifecycle.
This topic describes the meaning of aliases and how to create, update, view, and delete
aliases in the Function Compute console.
What is an alias?
Function Compute support for creating aliases for versions of services. An alias can be understood
as a pointer to a specific version. You can use an alias to publish, roll back, or
canary release a version with ease. An alias is dependent on a service or a version.
When you use an alias to access a service or function, the Function Compute resolves the alias to the version it points to. The caller does not need to know
the specific version that the alias points to.
Take an HTTP trigger as an example. If there is no alias, every time a new version
is launched, you need to manually modify the version number associated with the HTTP
trigger, which will affect the use of the client during the modification process.
In contrast, if you use an alias to manage the version, you can hitlessly upgrade
the version. As shown in the following figure, point the alias PROD to the stable
version 1. The client directly uses the alias PROD to invoke the function in the service
of Version 1.
Figure 1. Publish 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. Publishing in this way does not affect the use of clients.
In the left-side navigation pane, click Services and Functions.
In the top navigation bar, select the region where the service resides.
On the Services and Functions page, click the target service. In the left-side navigation pane, click Aliases.
On the Aliases page, click Create Alias.
In the Create Alias panel, enter the alias information and click OK.
The following table describes the parameters.
Parameter
Configuration method
Example
Parameter
The name of the alias.
alias
Description
The description of the alias.
N/A
Version
Select a stable master version.
1
Enable canary version
If you want to cut some traffic to the canary version, select Yes. Otherwise, select No.
Yes
Additional version ID
Select a phased release version. This parameter is required when you need to cut some
traffic to the canary version.
2
Grayscale version weight
Enter the weight of the canary version, that is, how much ratio of traffic needs to
be switched to the canary version. This parameter is required when you need to cut
some traffic to the canary version.
5
On the Aliases page of the target service, you can view the created alias. In this example, the
alias points to version 1, the canary version is version 2, and the canary version
weight is 5%.
In the left-side navigation pane, click Services and Functions.
In the top navigation bar, select the region where the service resides.
On the Services and Functions page, click the target service. In the left-side navigation pane, click Aliases.
On the Aliases page, find the alias that you want to modify and click Modify in the Actions column.
In the Edit Alias panel, modify the alias information and click OK.
Parameter
Configuration method
Example
Parameter
The name of the alias.
alias
Description
The description of the alias.
N/A
Version
Select a stable master version.
1
Enable canary version
If you want to cut some traffic to the canary version, select Yes. Otherwise, select No.
Yes
Additional version ID
Select a phased release version. This parameter is required when you need to cut some
traffic to the canary version.
2
Grayscale version weight
Enter the weight of the canary version, that is, how much ratio of traffic needs to
be switched to the canary version. This parameter is required when you need to cut
some traffic to the canary version.
5
Delete an alias
Note When you delete an alias, only the alias is deleted. The version to which the alias
points and triggers that points to the alias are retained.
In the left-side navigation pane, click Services and Functions.
In the top navigation bar, select the region where the service resides.
On the Services and Functions page, click the target service. In the left-side navigation pane, click Aliases.
On the Aliases page, find the alias that you want to delete and click Delete in the Actions column.
In the OK dialog box, read the message and click Delete.
References
In addition to using the console, you can also use Serverless Devs to configure aliases
for services. For more information, see YAML files and Non-YAML files.