Cette rubrique explique comment utiliser un modèle Resource Orchestration Service (ROS) pour créer une instance Tablestore.
Prérequis
Vous avez activé Tablestore.
Procédure
-
Accédez à la page Stacks.
Connectez-vous à la console ROS.
Dans le volet de navigation de gauche, choisissez Deployment > Stacks.
Dans la barre de navigation supérieure, sélectionnez une région.
-
Créez une stack.
Sur la page Stacks, cliquez sur Create Stack.
Dans la section Specify Template, cliquez sur Select an Existing Template et définissez Template Import Method sur Enter Template Content.
-
Dans la section Template Content, sous l'onglet ROS, saisissez le modèle au format
YAMLouJSON, puis cliquez sur Next.V2 (recommandé)
Le modèle suivant illustre la création d'une instance Tablestore V2. Pour plus d'informations sur la syntaxe, les paramètres et des exemples, consultez ALIYUN::OTS::InstanceV2.
JSON{ "ROSTemplateFormatVersion": "2015-09-01", "Parameters": { "InstanceName": { "Type": "String", "Description": { "en": "Specifies the instance name. The name must meet the following requirements:\n- Be 3 to 16 characters long.\n- Contain only letters, numbers, and dashes (-).\n- Start with a letter.\n- Not end with a dash (-).\n- Be case-insensitive." }, "Required": true, "AllowedPattern": "[A-Za-z][A-Za-z0-9\\-]*[A-Za-z0-9]$", "MinLength": 3, "MaxLength": 16 }, "ClusterType": { "Type": "String", "Description": { "en": "The cluster type, which corresponds to the instance type.\nValid values:\n- SSD: High-performance\n- HYBRID: Capacity" }, "AllowedValues": [ "SSD", "HYBRID" ], "Required": true } }, "Resources": { "InstanceV2": { "Type": "ALIYUN::OTS::InstanceV2", "Properties": { "InstanceName": { "Ref": "InstanceName" }, "InstanceDescription": "The description of the instance.", "ClusterType": { "Ref": "ClusterType" }, "NetworkSourceACL": [ "TRUST_PROXY" ], "NetworkTypeACL": [ "INTERNET", "VPC", "CLASSIC" ], "Tags": [ { "Key": "environment", "Value": "testing" } ] } } }, "Outputs": { "InstanceName": { "Description": "The name of the Tablestore instance.", "Value": { "Fn::GetAtt": [ "InstanceV2", "InstanceName" ] } } } }YAMLROSTemplateFormatVersion: '2015-09-01' Parameters: InstanceName: Type: String Description: en: | Specifies the instance name. The name must meet the following requirements: - Be 3 to 16 characters long. - Contain only letters, numbers, and dashes (-). - Start with a letter. - Not end with a dash (-). - Be case-insensitive. Required: true AllowedPattern: '[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9]$' MinLength: 3 MaxLength: 16 ClusterType: Type: String Description: en: |- The cluster type, which corresponds to the instance type. Valid values: - SSD: High-performance - HYBRID: Capacity AllowedValues: - SSD - HYBRID Required: true Resources: InstanceV2: Type: ALIYUN::OTS::InstanceV2 Properties: InstanceName: Ref: InstanceName InstanceDescription: The description of the instance. ClusterType: Ref: ClusterType NetworkSourceACL: - TRUST_PROXY NetworkTypeACL: - INTERNET - VPC - CLASSIC Tags: - Key: "environment" Value: "testing" Outputs: InstanceName: Description: The name of the Tablestore instance. Value: Fn::GetAtt: - InstanceV2 - InstanceNameV1
Le modèle suivant illustre la création d'une instance Tablestore V1. Pour plus d'informations sur la syntaxe, les paramètres et des exemples, consultez ALIYUN::OTS::Instance.
JSON
{ "ROSTemplateFormatVersion": "2015-09-01", "Parameters": { }, "Resources": { "Instance": { "Type": "ALIYUN::OTS::Instance", "Properties": { "InstanceName": "instance-demo", "Description": "The description of the instance.", "ClusterType": "SSD", "Network": "NORMAL" } } }, "Outputs": { "InstanceName": { "Description": "The instance name.", "Value": { "Fn::GetAtt": [ "Instance", "InstanceName" ] } }, "VpcEndpoint": { "Description": "The VPC endpoint.", "Value": { "Fn::GetAtt": [ "Instance", "VpcEndpoint" ] } }, "PublicEndpoint": { "Description": "The public endpoint.", "Value": { "Fn::GetAtt": [ "Instance", "PublicEndpoint" ] } }, "PrivateEndpoint": { "Description": "The private endpoint.", "Value": { "Fn::GetAtt": [ "Instance", "PrivateEndpoint" ] } } } }YAML
ROSTemplateFormatVersion: '2015-09-01' Parameters: {} Resources: Instance: Type: ALIYUN::OTS::Instance Properties: InstanceName: instance-demo Description: The description of the instance. ClusterType: SSD Network: NORMAL Outputs: InstanceName: Description: The instance name. Value: Fn::GetAtt: - Instance - InstanceName VpcEndpoint: Description: The VPC endpoint. Value: Fn::GetAtt: - Instance - VpcEndpoint PublicEndpoint: Description: The public endpoint. Value: Fn::GetAtt: - Instance - PublicEndpoint PrivateEndpoint: Description: The private endpoint. Value: Fn::GetAtt: - Instance - PrivateEndpoint À l'étape Configure Parameters, saisissez un Stack Name. Pour les modèles V2, spécifiez également InstanceName et ClusterType. Pour plus d'informations sur la configuration des stacks, consultez Paramètres de configuration des stacks.
-
Cliquez sur Create.
Une fois la stack créée, son Status dans l'onglet Stack Information affiche Creation successful.
-
Vérifiez le déploiement.
Cliquez sur l'onglet Resources pour consulter le Resource ID, qui correspond au nom de l'instance Tablestore.
Connectez-vous à la console Tablestore pour afficher la nouvelle instance.
Sur la page Instance List, repérez la nouvelle instance, par exemple
instance-demo, et vérifiez que son statut est Running. Le nom figurant dans la colonne Instance Alias/Name correspond au resource ID de la stack.