文档

云市场服务计费与资源计费绑定

更新时间:

本文介绍如何对需要发布到云市场的计算巢服务绑定服务与资源的付费方式。

背景信息

在云市场购买计算巢服务时,实际上购买的是计算巢服务的软件及所需资源。若您希望商品或服务的使用周期与资源或硬件的使用周期保持一致,即当用户购买的是包年包月的计算巢服务,创建服务实例时创建的对应资源也是包年包月且使用周期和软件保持一致(按量付费方式与包年包月的原理相同),则在创建服务时,需要在模板内容中定义资源的付费类型,并设置付费类型绑定关系。

创建服务

创建资源和软件生命周期绑定的服务。

  1. 登录计算巢控制台

  2. 在左侧导航栏中,选择服务目录 > 我的服务,在我的服务页面中,选择我发布的服务,然后单击创建新服务

  3. 创建新服务页面,设置服务信息。

    此处只列举需要特别配置的参数,关于其他参数的配置,请参见创建私有部署服务创建全托管服务

    在定义模板时,您需要在ParametersMetadata中,添加如下参数。完成的模板内容,请参见模板示例

    • Parameters中,您需要对您定义的付费类型(ChargeType)、付费周期(PayPeriodUnit)或付费时长(PayPeriod)等参数,分别添加对应的AssociationProperty

    • Metadata中,您需要添加ALIYUN::ROS::Interface并定义MapOrderParameterToMarket字段为true。

    {
        "Parameters":{
        "ChargeType": {
          "AssociationProperty": "ChargeType",
        },
        "PeriodUnit": {
          "AssociationProperty": "PayPeriodUnit"
        },
        "Period": {
          "AssociationProperty": "PayPeriod"
        },
      },
      "Metadata": {
        "ALIYUN::ROS::Interface": {
          "MapOrderParameterToMarket": true
        }
      }
    }
  4. 单击保存服务

  5. 服务测试。

    服务保存后,您需要对创建的服务进行测试,保证其正常可用。更多信息,请参见测试服务

  6. 发布服务。

    服务测试通过后,再提交审核,审核通过后即可发布上线。更多信息,请参见上线服务

将服务上架到云市场

在计算巢控制台将服务发布上线之后,将已发布上线的服务上架到云市场。关于如何将服务上架到云市场的操作,请参见将服务上架到云市场

在云市场验证资源付费方式是否和软件保持一致

  1. 进入商品详情页。

    • 在云市场查找商品:

      1. 进入云市场首页

      2. 搜索想要购买的商品名称,单击搜索

      3. 找到待购买的商品,单击商品。

    • 直接从服务商处获取云市场的商品链接,打开该链接。

  2. 在商品详情页,选择商品购买信息,并单击立即购买

  3. 确认订单页面,确认商品信息并配置云资源信息。

    • 若云市场商品的购买方式为按量付费,在资源信息配置界面的实例付费方式也是按量付费且不可更改。

      商品购买界面如下图所示。

      按量付费

      资源配置界面的付费模式如下图所示。

      按量付费

    • 若云市场商品的购买方式为包年包月,在资源信息配置界面的实例付费方式也是包年包月,且资源付费时长和商品时长相同。

      商品购买界面如下图所示。

      按周期购买

      资源配置界面的付费模式如下图所示。

      按周期购买

模板示例

完整的示例模板如下。

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "zh-cn": "此模板为单实例自定义镜像模板示例,支持选择已有基础资源配置,支持配置ECS的付费模式为预付费或者后付费",
    "en": "This template supports single-instance with custom image, including scenarios using existing and creating ECS by prepaid or postpaid model"
  },
  "Parameters": {
    "SystemDiskCategory": {
      "AssociationProperty": "ALIYUN::ECS::Disk::SystemDiskCategory",
      "AssociationPropertyMetadata": {
        "InstanceType": "InstanceType",
        "ZoneId": "ZoneId"
      },
      "Type": "String",
      "Description": {
        "zh-cn": "<font color='blue'><b>可选值:</b></font><br>[cloud_efficiency: <font color='green'>高效云盘</font>]<br>[cloud_ssd: <font color='green'>SSD云盘</font>]<br>[cloud_essd: <font color='green'>ESSD云盘</font>]<br>[cloud: <font color='green'>普通云盘</font>]",
        "en": "<font color='blue'><b>Optional values:</b></font><br>[cloud_efficiency: <font color='green'>Efficient Cloud Disk</font>]<br>[cloud_ssd: <font color='green'>SSD Cloud Disk</font>]<br>[cloud_essd: <font color='green'>ESSD Cloud Disk</font>]<br>[cloud: <font color='green'>Cloud Disk</font>]"
      },
      "Label": {
        "zh-cn": "系统盘类型",
        "en": "System Disk Type"
      }
    },
    "ECSPeriodUnit": {
            "AssociationProperty": "PayPeriodUnit",
      "AssociationPropertyMetadata": {
        "Visible": {
          "Condition": {
            "Fn::Not": {
              "Fn::Equals": [
                "${InstanceChargeType}",
                "PostPaid"
              ]
            }
          }
        }
      },
      "Description": {
        "zh-cn": "云服务器预付费资源的购买时长周期,取值:[Month(月), Year(年)],<br>",
        "en": "ECS Purchase cycle of prepaid resource, value: [Week, Month]<br>"
      },
      "Default": "Month",
      "AllowedValues": [
        "Month",
        "Year"
      ],
      "Label": {
        "zh-cn": "云服务器预付费资源的购买周期",
        "en": "ECS Purchase cycle of prepaid resources"
      },
      "Type": "String"
    },
    "ECSPeriod": {
      "AssociationProperty": "PayPeriod",
      "AssociationPropertyMetadata": {
        "Visible": {
          "Condition": {
            "Fn::Not": {
              "Fn::Equals": [
                "${InstanceChargeType}",
                "PostPaid"
              ]
            }
          }
        }
      },
      "Description": {
        "zh-cn": "云服务器预付费资源的购买时长,当预付费资源的购买周期为Year时,取值范围:[1,2]; 当预付费资源的购买周期为Month时,取值:[1,2,3,4,5]<br>",
        "en": "When the purchase cycle of prepaid resource is week, the value range is: [1,2,3,4]; when the purchase cycle of prepaid resource is month, the value is: [1,2,3,4,5,6,7,8,9,12,24,36,48,60]<br>"
      },
      "Default": 1,
      "Label": {
        "zh-cn": "云服务器预付费资源的购买时长",
        "en": "ECS Purchase duration of prepaid resources"
      },
      "AllowedValues": [
        1,
        2,
        3,
        4,
        5,
        6,
        7,
        8,
        9,
        12
      ],
      "Type": "Number"
    },
    "SecurityGroupId": {
      "AssociationPropertyMetadata": {
        "VpcId": "VpcId"
      },
      "Description": {
        "zh-cn": "现有安全组的实例ID",
        "en": "The instance ID of an existing security group."
      },
      "Default": null,
      "Label": {
        "zh-cn": "安全组ID",
        "en": "Security Group ID"
      },
      "AssociationProperty": "ALIYUN::ECS::SecurityGroup::SecurityGroupId",
      "Type": "String"
    },
    "SystemDiskSize": {
      "Default": 40,
      "Type": "Number",
      "Description": {
        "zh-cn": "系统盘大小, 取值范围:[40, 500], 单位:GB。",
        "en": "System disk size, range of values: 40-500, units: GB."
      },
      "Label": {
        "zh-cn": "系统盘空间",
        "en": "System Disk Space"
      }
    },
    "ZoneId": {
      "AssociationProperty": "ALIYUN::ECS::Instance::ZoneId",
      "Type": "String",
      "Description": {
        "zh-cn": "可用区配置决定了新建ECS实例的可用区。此外,如果您选择已有基础资源配置,仅能选到该可用区下的交换机。",
        "en": "ECS VSwitch Zone ID defines the Availability Zone for creating ECS instance. If you choose existing Infrastructure Configuration,you can only find the VSwitch under the Availability zone."
      },
      "Label": {
        "zh-cn": "ECS交换机可用区",
        "en": "ECS VSwitch Zone ID"
      }
    },
    "DataDiskCategory": {
      "AssociationProperty": "ALIYUN::ECS::Disk::DataDiskCategory",
      "AssociationPropertyMetadata": {
        "InstanceType": "InstanceType",
        "ZoneId": "ZoneId"
      },
      "Type": "String",
      "Description": {
        "zh-cn": "<font color='blue'><b>可选值:</b></font><br>[cloud_efficiency: <font color='green'>高效云盘</font>]<br>[cloud_ssd: <font color='green'>SSD云盘</font>]<br>[cloud_essd: <font color='green'>ESSD云盘</font>]<br>[cloud: <font color='green'>普通云盘</font>]",
        "en": "<font color='blue'><b>Optional values:</b></font><br>[cloud_efficiency: <font color='green'>Efficient Cloud Disk</font>]<br>[cloud_ssd: <font color='green'>SSD Cloud Disk</font>]<br>[cloud_essd: <font color='green'>ESSD Cloud Disk</font>]<br>[cloud: <font color='green'>Cloud Disk</font>]"
      },
      "Label": {
        "zh-cn": "数据盘类型",
        "en": "Data Disk Type"
      }
    },
    "InstanceChargeType": {
      "Default": "PostPaid",
      "AssociationProperty": "ChargeType",
      "Label": {
        "zh-cn": "ECS实例的付费模式",
        "en": "ECS Instance Billing Method"
      },
      "Type": "String",
      "Description": {
        "zh-cn": "<font color='blue'><b>可选值:</b></font><br>[PostPaid: <font color='green'>按量付费。</font>]<br>[PrePaid: <font color='green'>预付费,包年包月。</font>]",
        "en": "<font color='blue'><b>Optional values:</b></font><br>[PostPaid: <font color='green'>Pay as you go.</font>]<br> [PrePaid: <font color='green'>Prepaid, subscription.</font>]"
      },
      "AllowedValues": [
        "PostPaid",
        "PrePaid"
      ]
    },
    "VpcId": {
      "Default": null,
      "AssociationProperty": "ALIYUN::ECS::VPC::VPCId",
      "Type": "String",
      "Description": {
        "zh-cn": "请选择已有的VPC<br><b><font color='blue'>如找不到VPC,请切换地域。</font></b>",
        "en": "Please select the existing VPC. <br><b><font color='blue'>If you can't find the VPC, please switch Regions.</font></b>"
      },
      "Label": {
        "zh-cn": "现有VPC的实例ID",
        "en": "Existing VPC ID"
      }
    },
    "DataDiskSize": {
      "Description": {
        "zh-cn": "ECS实例数据盘大小,单位为GiB。取值范围:20~32768",
        "en": "ECS Instance disk size, range of values: 20-32768, units: GB"
      },
      "Default": 100,
      "MaxValue": 32768,
      "MinValue": 20,
      "Label": {
        "zh-cn": "数据盘空间",
        "en": "Data Disk Space"
      },
      "Type": "Number"
    },
    "VSwitchId": {
      "AssociationPropertyMetadata": {
        "VpcId": "VpcId",
        "ZoneId": "ZoneId"
      },
      "Description": {
        "zh-cn": "现有网络交换机的实例ID",
        "en": "The instance ID of an existing network switch."
      },
      "Default": null,
      "Label": {
        "zh-cn": "网络交换机ID",
        "en": "VSwitch ID"
      },
      "AssociationProperty": "ALIYUN::ECS::VSwitch::VSwitchId",
      "Type": "String"
    },
    "Password": {
      "ConstraintDescription": {
        "zh-cn": "长度8-30,必须包含三项(大写字母、小写字母、数字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符号)。",
        "en": "Length 8-30, must contain three(Capital letters, lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in)."
      },
      "Description": {
        "zh-cn": "服务器登录密码,长度8-30,必须包含三项(大写字母、小写字母、数字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符号)。",
        "en": "Server login password, Length 8-30, must contain three(Capital letters, lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in)."
      },
      "MinLength": 8,
      "Label": {
        "zh-cn": "实例密码",
        "en": "Instance Password"
      },
      "AllowedPattern": "[0-9A-Za-z\\_\\-\\&:;'<>,=%`~!@#\\(\\)\\$\\^\\*\\+\\|\\{\\}\\[\\]\\.\\?\\/]+$",
      "NoEcho": true,
      "MaxLength": 30,
      "Type": "String"
    },
    "InstanceType": {
      "AssociationProperty": "ALIYUN::ECS::Instance::InstanceType",
      "AssociationPropertyMetadata": {
        "InstanceChargeType": "${InstanceChargeType}",
        "ZoneId": "ZoneId"
      },
      "Type": "String",
      "Label": {
        "zh-cn": "实例类型",
        "en": "Instance Type"
      }
    },
    "InternetChargeType": {
      "Type": "String",
      "Description": {
        "zh-cn": "<font color='blue'><b>可选值:</b></font><br>[PayByBandwidth: <font color='green'>按带宽付费。</font>]<br>[PayByTraffic: <font color='green'>按流量付费。</font>],<br>默认为PayByTraffic",
        "en": "<font color='blue'><b>Optional values:</b></font><br>[PayByBandwidth: <font color='green'>Pay by bandwidth. </font>]<br>[PayByTraffic: <font color='green'>Pay by traffic. </font>],<br>The default is PayByTraffic"
      },
      "Label": {
        "en": "InternetChargeType",
        "zh-cn": "流量付费类型"
      },
      "AllowedValues": [
        "PayByBandwidth",
        "PayByTraffic"
      ],
      "Default": "PayByTraffic"
    },
    "InternetMaxBandwidthOut": {
      "Type": "Number",
      "Description": {
        "en": "ECS Internet Max Bandwidth Out. Value range: 0~100. Unit: Mbps. Default value: 0.",
        "zh-cn": "ECS最大出带宽。取值范围:0~100。单位:Mbps。默认值:0。"
      },
      "Label": {
        "en": "Internet Max BandwidthOut ",
        "zh-cn": "实例公网带宽"
      },
      "Default": 0,
      "MaxValue": 100,
      "MinValue": 0
    }
  },
  "Outputs": {
    "InstanceIds": {
      "Value": {
        "Fn::GetAtt": [
          "ECSInstances",
          "InstanceIds"
        ]
      }
    }
  },
  "Conditions": {},
  "Resources": {
    "ECSInstances": {
      "Type": "ALIYUN::ECS::InstanceGroup",
      "Properties": {
        "SystemDiskCategory": {
          "Ref": "SystemDiskCategory"
        },
        "VpcId": {
          "Ref": "VpcId"
        },
        "InstanceChargeType": {
          "Ref": "InstanceChargeType"
        },
        "AllocatePublicIP": true,
        "SecurityGroupId": {
          "Ref": "SecurityGroupId"
        },
        "InternetChargeType": {
          "Ref": "InternetChargeType"
        },
        "InternetMaxBandwidthOut": {
          "Ref": "InternetMaxBandwidthOut"
        },
        "DiskMappings": [
          {
            "Category": {
              "Ref": "DataDiskCategory"
            },
            "Size": {
              "Ref": "DataDiskSize"
            }
          }
        ],
        "SystemDiskSize": {
          "Ref": "SystemDiskSize"
        },
        "ImageId": "centos_7",
        "PeriodUnit": {
          "Ref": "ECSPeriodUnit"
        },
        "VSwitchId": {
          "Ref": "VSwitchId"
        },
        "Period": {
          "Ref": "ECSPeriod"
        },
        "Password": {
          "Ref": "Password"
        },
        "InstanceType": {
          "Ref": "InstanceType"
        },
        "ZoneId": {
          "Ref": "ZoneId"
        },
        "MaxAmount": 1
      },
      "Metadata": {
        "ALIYUN::ROS::Designer": {
          "id": "3d97f557-f6c2-475f-bdca-942c45e583b5"
        }
      }
    }
  },
  "Metadata": {
    "ALIYUN::ROS::Interface": {
      "ParameterGroups": [
        {
          "Parameters": [
            "ZoneId"
          ],
          "Label": {
            "default": {
              "zh-cn": "可用区配置",
              "en": "Zone Configuration"
            }
          }
        },
        {
          "Parameters": [
            "VpcId",
            "VSwitchId",
            "SecurityGroupId"
          ],
          "Label": {
            "default": {
              "zh-cn": "选择已有基础资源配置",
              "en": "Choose existing Infrastructure Configuration"
            }
          }
        },
        {
          "Parameters": [
            "InstanceChargeType",
            "ECSPeriodUnit",
            "ECSPeriod",
            "InstanceType",
            "SystemDiskCategory",
            "SystemDiskSize",
            "DataDiskCategory",
            "DataDiskSize",
            "InternetChargeType",
            "InternetMaxBandwidthOut",
            "Password"
          ],
          "Label": {
            "default": {
              "zh-cn": "ECS 配置(必填)",
              "en": "ECS Configuration"
            }
          }
        }
      ],
      "TemplateTags": [
        "acs:example:ISV软件部署:自定义镜像创建单实例ECS云服务器"
      ],
      "MapOrderParameterToMarket": true
    }
  }
}

  • 本页导读 (0)
文档反馈