How Do I Use the Versions and Aliases of an HTTP Function with an APIG Trigger for Gray Upgrade?
- Create versions V1 and V2 based on latest, create an alias named alias for V1 with a 100% weight, and create an APIG trigger for alias. Figure 1 Publishing versions V1 and V2
Figure 2 Creating alias and binding V1 to it
Figure 3 Creating a trigger for alias
You can create APIG triggers for a function alias or version. By default, a trigger name is API_{Function name}{Version}, and the request path is /{Function name}-{Version}.
An APIG trigger URL will only be used either for an alias or its matched version. For example, assume that V1 has been bound to alias. If you create a trigger with the default name API_testapigV1 for V1 and then create another trigger with the same name and URL for alias, the API_testapigV1 trigger will not be displayed in the trigger list of V1.
- Go back to the Aliases tab page of latest, click Edit in the row of alias, and set Additional Version to V2 with a custom weight. This is for gray upgrade from V1 to V2.
Weights indicate the percentage of received data that will be allocated to corresponding versions. You can set a weight that meets your service requirements.
Figure 4 Editing an alias
- Create version V3, click Edit in the row of alias on the Aliases tab page, and change Version to V2 and Additional Version to V3 with a custom weight. This is for gray upgrade from V2 to V3. Figure 5 Creating V3
Figure 6 Editing an alias
After publishing a version based on latest, you can publish more versions only after making a configuration or code change on the function.
Aliases bound with triggers cannot be deleted.