For a fully managed service, if your template parameters have dependencies, you can configure parameter mappings. This lets you set parameters to fixed values under certain conditions. When Compute Nest deploys a service instance, it automatically uses your configured values for the deployment if the conditions are met. This topic describes how to configure parameter mappings.
Background information
A fully managed service supports two methods for adding mappings: Add and Add by Using Stack Groups. After you configure the mappings, the corresponding parameters are automatically hidden. When a user creates a service instance, only the dependency parameter is displayed. After the user selects a value for the dependency parameter, the hidden parameters are automatically populated with the values set in the mapping.
Add: Use this method to configure parameter mappings for a small number of regions. The service provider sets mappings and sub-dependency mappings for the template parameters. This involves selecting the dependency parameters and corresponding parameters, and setting their values.
Add by Using Stack Groups: Use this method when a service is deployed across multiple zones in multiple regions and a parameter mapping is required for each region. A service provider can use a stack group to simplify the configuration of parameter mappings.
Directly add parameter mappings
Procedure
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 New Service page, set the service information.
This section describes only the parameters that require special configuration for parameter mapping. For more information about other parameters, see Create a fully managed service.
In the Template Content box, enter the template content. For more information about the template content, see Sample template.
Click Add Parameter Mapping. In the Add Parameter Mapping dialog box that appears, select Add and configure the parameters.
In the Configure Mapping and Configure a mapping for a sub-dependency item sections, Select a dependency parameter and Select a corresponding parameter.
Click Add Parameter Mapping, and set the values for the Dependency Parameter and Parameter.
For the dependency parameter
Region, selectChina (Hangzhou). For the corresponding parameterVpcId, select an existing VPC.Click Add Sub-dependency Parameter, and select the values for the Sub-dependency Parameter and Corresponding Parameter.
For the sub-dependency parameter
ZoneId, selectChina (Hangzhou) Zone K. For the corresponding parametervSwitchId, select an existing vSwitch. Repeat this step to addChina (Hangzhou) Zone Jand a vSwitch for that zone.Click OK.
Click Save Service.
Use a stack group to add parameter mappings
Procedure
Log on to the Compute Nest console.
In the navigation pane on the left, click My Services. On the Created Services tab of the My Services page, click Understand and Create Now.
On the Create Service page, set the service information.
This section describes only the parameters that require special configuration for adding parameter mappings using a stack group. For more information about other parameters, see Create a fully managed service.
Click Add Parameter Mapping. In the Add Parameter Mapping dialog box that appears, configure the parameters.
Select the Add by Using Stack Groups tab and add a stack group.
If you have an existing stack group, you can select its region and ID in the stack group section.
If you have not created a stack group, you must first create one and then select it. For more information, see Create a stack group.
To simplify the process, Compute Nest provides two best-practice templates for creating stack groups. These templates create resources such as VPCs, vSwitches, and security groups in each zone of each region. Click the name of a template to go to the stack group creation page. Then, follow the on-screen instructions to enter the parameters and create the stack group.
When you use the Create a VPC, vSwitch, and security group in a region and specify the number of zones template to create a stack, you must specify the number of zones. The number of zones cannot be greater than the actual number of zones in the region.
When you use the Create VPCs, vSwitches, and security groups in all zones of a region template to create a stack, the resources are created in all zones of the region by default.
Click OK.
Compute Nest automatically generates the parameter mappings. This process may take a few seconds.
Click Create Service. In the confirmation dialog box that appears, click OK.
Effect on service instance deployment
Service instance deployment interface
After the service is created, on the service instance deployment page, the user needs to select only the Region and Zone that are configured in the parameter mapping. The VPC and vSwitch parameters are not visible to the user.
After service instance deployment
After the service instance is successfully deployed, the VPC and vSwitch parameters are also not visible to the user.
Sample template
ROSTemplateFormatVersion: '2015-09-01'
Description:
en: >-
This is a sample template for creating a single ECS instance from a custom image. You can use existing infrastructure resources and select subscription or pay-as-you-go as the billing method.
Parameters:
SystemDiskCategory:
AssociationProperty: 'ALIYUN::ECS::Disk::SystemDiskCategory'
AssociationPropertyMetadata:
InstanceType: InstanceType
ZoneId: ZoneId
Type: String
Description:
en: >-
<font color='blue'><b>Valid values:</font><br/>[cloud_efficiency: <font
color='green'>Ultra Disk</font>]<br>[cloud_ssd: <font
color='green'>Standard SSD</font>]<br>[cloud_essd: <font
color='green'>ESSD</font>]<br>[cloud: <font
color='green'>Basic Disk</font>]
Label:
en: System Disk Type
ECSPeriodUnit:
AssociationPropertyMetadata:
Visible:
Condition:
'Fn::Not':
'Fn::Equals':
- '${InstanceChargeType}'
- PostPaid
Description:
en: 'The unit of the subscription duration for the subscription ECS instance. Valid values: Week and Month.<br>'
Default: Week
AllowedValues:
- Week
- Month
Label:
en: Unit of Subscription Duration
Type: String
ECSPeriod:
AssociationPropertyMetadata:
Visible:
Condition:
'Fn::Not':
'Fn::Equals':
- '${InstanceChargeType}'
- PostPaid
Description:
en: >-
The subscription duration. If the Unit of Subscription Duration is set to Week, the valid values are 1, 2, 3, and 4. If the Unit of Subscription Duration is set to Month, the valid values are 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 24, 36, 48, and 60.<br>
Default: 1
Label:
en: Subscription Duration
AllowedValues:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 12
- 24
- 36
- 48
- 60
Type: Number
SecurityGroupId:
AssociationPropertyMetadata:
VpcId: VpcId
Description:
en: The instance ID of an existing security group.
Default: null
Label:
en: Security Group ID
AssociationProperty: 'ALIYUN::ECS::SecurityGroup::SecurityGroupId'
Type: String
SystemDiskSize:
Default: 40
Type: Number
Description:
en: 'The size of the system disk. Value range: 40 to 500. Unit: GB.'
Label:
en: System Disk Size
ZoneId:
AssociationProperty: 'ALIYUN::ECS::Instance::ZoneId'
Type: String
Description:
en: >-
The zone in which to create the ECS instance. If you use existing infrastructure resources, you can select only vSwitches that are in the specified zone.
Label:
en: Zone
DataDiskCategory:
AssociationProperty: 'ALIYUN::ECS::Disk::DataDiskCategory'
AssociationPropertyMetadata:
InstanceType: InstanceType
ZoneId: ZoneId
Type: String
Description:
en: >-
<font color='blue'><b>Valid values:</font><br/>[cloud_efficiency: <font
color='green'>Ultra Disk</font>]<br>[cloud_ssd: <font
color='green'>Standard SSD</font>]<br>[cloud_essd: <font
color='green'>ESSD</font>]<br>[cloud: <font
color='green'>Basic Disk</font>]
Label:
en: Data Disk Type
InstanceChargeType:
Default: PostPaid
Label:
en: ECS Instance Billing Method
Type: String
Description:
en: >-
<font color='blue'><b>Valid values:</font><br/>[PostPaid: <font
color='green'>Pay-as-you-go.</font>]<br>[PrePaid: <font
color='green'>Subscription.</font>]
AllowedValues:
- PostPaid
- PrePaid
VpcId:
Default: null
AssociationProperty: 'ALIYUN::ECS::VPC::VPCId'
Type: String
Description:
en: >-
Select an existing VPC.<br/><b><font color='blue'>If you cannot find the VPC, switch to another region.</font>
Label:
en: Existing VPC ID
DataDiskSize:
Description:
en: 'The size of the data disk. Unit: GiB. Value range: 20 to 32768.'
Default: 100
MaxValue: 32768
MinValue: 20
Label:
en: Data Disk Size
Type: Number
VSwitchId:
AssociationPropertyMetadata:
VpcId: VpcId
ZoneId: ZoneId
Description:
en: The ID of an existing vSwitch.
Default: null
Label:
en: VSwitch ID
AssociationProperty: 'ALIYUN::ECS::VSwitch::VSwitchId'
Type: String
Password:
ConstraintDescription:
en: >-
The password must be 8 to 30 characters in length and contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters from the following set: ()`~!@#$%^&*_-+=|{}[]:;''<>,.?/
Description:
en: >-
The logon password for the instance. The password must be 8 to 30 characters in length and contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters from the following set: ()`~!@#$%^&*_-+=|{}[]:;''<>,.?/
MinLength: 8
Label:
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:
en: Instance Type
InternetChargeType:
Type: String
Description:
en: >-
<font color='blue'><b>Valid values:</font><br>[PayByBandwidth:
<font color='green'>Pay-by-bandwidth.</font>]<br>[PayByTraffic: <font
color='green'>Pay-by-traffic.</font>]<br>The default value is PayByTraffic.
Label:
en: Internet Billing Method
AllowedValues:
- PayByBandwidth
- PayByTraffic
Default: PayByTraffic
InternetMaxBandwidthOut:
Type: Number
Description:
en: >-
The maximum outbound public bandwidth. Value range: 0 to 100. Unit: Mbit/s. Default value: 0.
Label:
en: Maximum Public Bandwidth
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:
en: Zone Configuration
- Parameters:
- VpcId
- VSwitchId
- SecurityGroupId
Label:
default:
en: Select Existing Infrastructure Resources
- Parameters:
- InstanceChargeType
- ECSPeriodUnit
- ECSPeriod
- InstanceType
- SystemDiskCategory
- SystemDiskSize
- DataDiskCategory
- DataDiskSize
- InternetChargeType
- InternetMaxBandwidthOut
- Password
Label:
default:
en: ECS Configuration (Required)
TemplateTags:
- 'acs:example:ISV Software Deployment:Create a single ECS instance from a custom image'