This topic describes how to bind billing configurations for Compute Nest services and their associated resources before publishing them to Alibaba Cloud Marketplace.
Background information
When users purchase a Compute Nest service from Alibaba Cloud Marketplace, they acquire both the software and its required cloud resources.
To align the software usage period with the usage period of its associated resources or hardware, define the resource billing type in your template. For example, if users purchase a subscription-based Compute Nest service, the resources created with the service instance must also use the subscription billing method. The same principle applies to pay-as-you-go billing. To achieve this, configure billing type binding in your template.
Software supports auto-renewal. To synchronize resource auto-renewal with software auto-renewal, configure auto-renewal binding between the software and its resources.
If you do not want to display billing type information on the service instance interface, add a hidden setting in your template.
Create a service
Create a service that binds the lifecycles of resources and software.
Log on to the Compute Nest console.
In the left-side navigation pane, click My Services. On the Created Services tab of the My Services page, click Create Service.
On the Create Service page, configure service information.
This section lists only parameters that require special configuration. For other parameters, see Create a private service or Create a fully managed service.
When defining your template, add the following parameters to the
ParametersandMetadatasections. For the full template, see Sample template.Parameters: PayType: AssociationProperty: ChargeType PayPeriodUnit: AssociationProperty: PayPeriodUnit PayPeriod: AssociationProperty: PayPeriod AutoRenew: AssociationProperty: AutoRenew Metadata: ALIYUN::ROS::Interface: MapOrderParameterToMarket: true Hidden: - PayType - PayPeriodUnit - PayPeriod - AutoRenew HiddenSaleConfig: trueIn the
Parameterssection, add the correspondingAssociationPropertyfor each billing parameter, such as ChargeType, PayPeriodUnit, PayPeriod, or AutoRenew.NoteAutoRenew is optional. To link software auto-renewal with resource auto-renewal, set
AssociationProperty: AutoRenew. Also, in theResourcessection, reference this parameter for the resource's renewal property.In the
Metadatasection, addALIYUN::ROS::Interfaceand set theMapOrderParameterToMarketfield totrue.(Optional) Hide billing-related parameters in the template.
In the
Metadatasection, add theHiddenproperty and list the parameters to hide.In the
Metadatasection, add theHiddenSaleConfigparameter and set its value totrue.
Click Create Service.
Test the service.
After saving the service, test it to confirm it works correctly. 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.
List the service on Alibaba Cloud Marketplace
After publishing the service in the Compute Nest console, list it on Alibaba Cloud Marketplace. For instructions, see Publish a service as an Alibaba Cloud Marketplace product.
Verify that resource billing matches software billing on Alibaba Cloud Marketplace
Go to the product page.
Find the product in Alibaba Cloud Marketplace:
Go to the Alibaba Cloud Marketplace home page.
To search for the product that you want to purchase, click Search.
Find the product and click it.
Open the Alibaba Cloud Marketplace product link that you received from the service provider.
On the product page, select purchase options and click Buy Now.
On the Confirm Order page, review product details and configure cloud resources.
After binding (that is, after setting MapOrderParameterToMarket: true), the resource billing type follows the software billing type. The resource auto-renewal toggle follows the software auto-renewal toggle.
To hide these grayed-out fields from users, set the Hidden parameter.
Sample template
The complete sample template is shown below.
ROSTemplateFormatVersion: '2015-09-01'
Parameters:
AutoRenew:
Type: Boolean
Label:
en: AutoRenew
zh-cn: AutoRenew
AssociationProperty: AutoRenew
PayType:
Type: String
Label:
en: ECS Instance Charge Type
zh-cn: Billing Method
AssociationProperty: ChargeType
AssociationPropertyMetadata:
LocaleKey: InstanceChargeType
Default: PostPaid
AllowedValues:
- PostPaid
- PrePaid
PayPeriodUnit:
Type: String
Label:
en: Pay Period Unit
zh-cn: Subscription Duration Unit
AssociationProperty: PayPeriodUnit
AssociationPropertyMetadata:
Visible:
Condition:
Fn::Not:
Fn::Equals:
- ${PayType}
- PostPaid
Default: Month
AllowedValues:
- Month
- Year
PayPeriod:
Type: Number
Label:
en: Period
zh-cn: Subscription Duration
AssociationProperty: PayPeriod
AssociationPropertyMetadata:
Visible:
Condition:
Fn::Not:
Fn::Equals:
- ${PayType}
- PostPaid
Default: 1
AllowedValues:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
……
Resources:
EcsInstanceGroup:
Type: ALIYUN::ECS::InstanceGroup
Properties:
AutoRenew:
Ref: AutoRenew
InstanceChargeType:
Ref: PayType
PeriodUnit:
Ref: PayPeriodUnit
Period:
Ref: PayPeriod
……
……
Metadata:
ALIYUN::ROS::Interface:
MapOrderParameterToMarket: true
Hidden:
- ChargeType
- PeriodUnit
- Period
- AutoRenew
HiddenSaleConfig: true