If your private service needs to limit the application usage duration, retrieve custom information, or pass custom data to a service instance, you can configure a license when you create the service. This topic describes how to configure a license.
Background information
License settings allow you to specify the software usage duration and configure custom metadata. When the license of a service instance expires, its resources are not released. If you validate the license, a LicenseExpired status is returned. You can then configure the subsequent logic based on the returned status.
You can also modify the license of an existing service instance. You can stop the license, extend the license, or change the custom metadata.
Set the license
-
Log on to the Compute Nest console.
-
In the navigation pane on the left, click My Services. On the My Services page, click Services I Created and then click Create New Service.
-
On the Create New Service page, configure the service information.
This section describes only the parameters that are specific to license settings. For more information about other parameters, see Create a private service.
In the Tenant Settings section, configure the license parameters. This section contains the following configuration items.
-
Enable License Management: Turn on this switch to enable license management for the service. If you disable this feature, you do not need to configure the other license parameters.
-
Default License Duration (Days): Set the default validity period for the service instance in days. The maximum value is 1000. After this period, the service instance status changes to License Expired.
The validity period of a service instance is calculated by adding the default license duration to its creation time. After the service is published to Alibaba Cloud Marketplace, the default duration that you configure for the service becomes invalid. The license period is then determined by the expiration date on Alibaba Cloud Marketplace.
-
Custom Metadata: You can use this setting to specify limits other than the license duration. For example, you can limit the resource space of a service instance to 30 T. If the usage exceeds 30 T, your service can restrict certain features of the service instance based on the logic defined in your software.
-
Template: Select the template that you specified when you created the service.
-
Package: Select the package that you specified when you created the service. This parameter is optional if no package is available. If a package is available, this parameter is required.
-
Custom Metadata: Enter custom data to apply additional restrictions to the service. The custom metadata can be up to 1024 characters in length. The format is not restricted.
When you call the API operation to check the license, the content that you set is returned.
curl -H "Content-Type: application/json" -XPOST https://cn-wulanchabu.axt.aliyun.com/computeNest/license/check_out_license -d '{"Channel":"ComputeNest"}' {"Code":"200","requestId":"xxx","instanceId":"xxx","result":{"RequestId":"xxx","LicenseMetadata":{"TemplateName":"xxx"},"CustomData":"\301\","ExpireTime":"2022-09-12T11:02:32"}}NoteAfter you configure custom metadata, this content is returned when you check a custom license or an Alibaba Cloud Marketplace license.
-
-
-
Click Create Service. In the confirmation dialog box that appears, click OK.
-
Test the service.
After you save the service, you must test it to ensure that it runs properly. For more information, see Test a service.
Publish the service.
After the service passes the test, submit the service for review. After the review is passed, publish the service. For more information, see Publish a service.
Create a service instance
When you create a service instance that requires a license, a notice about the license is displayed on the creation page. For more information about how to create a service instance, see Create a private service instance. The notice includes the license validity period and states that after the license expires, the service instance resources are not released but the service becomes unavailable. To modify the license period, contact the service provider.
Modify the license period
Follow these steps if the license of a service instance expires or if you want to change the license information for a service instance.
Log on to the Compute Nest console.
-
In the navigation pane on the left, click Service Instances.
-
On the Service Instances page, click the tab under User's Service Instances and find the service instance that you want to manage.
-
In the Actions column, click Modify License. The service instances are displayed in a table. You can use filter conditions to locate the target instance.
-
In the dialog box that appears, modify the license parameters.
-
Modify License Period: Turn on this switch to stop the license for the service instance or extend its validity period.
You can extend the license by a specific number of days or until a specific date.
-
Modify Custom Metadata: You can modify the custom metadata at the same time you modify the license period.
The dialog box displays the current validity period and the extended validity period. Custom metadata modifications apply only to the current service instance.
-
-
Click OK.
After the modification is complete, the license check returns the following result.
curl -H "Content-Type: application/json" -XPOST https://cn-wulanchabu.axt.aliyun.com/computeNest/license/check_out_license -d '{"Channel":"ComputeNest"}' {"Code":"200","requestId":"xxx","result":{"RequestId":"C534F89E-B9AE-1C01-A29A-2C0AD836F995","LicenseMetadata":{"TemplateName":"Custom_Image_Ecs","SpecificationName":"xxx"},"CustomData":"50T","ExpireTime":"2022-10-05T11:06:16Z"}}