All Products
Search
Document Center

Tair (Redis® OSS-Compatible):Resource integration by using ROS

Last Updated:Aug 05, 2024

This topic describes how to use Resource Orchestration Service ROS as a Resource Access Management (RAM) user to create an ApsaraDB for Redis Enhanced Edition (Tair) instance and create a database account on the instance.

Create a RAM user and grant permissions to the RAM user

If you have created a RAM user and granted permissions to the RAM user, you can skip this step.

  1. To create a RAM user, perform the following steps:

    1. Go to the Users page of the RAM console, and then click Create User.

    2. Set Logon Name to redis-ros-test and Access Mode to OpenAPI Access.

    3. Click OK. After the RAM user is created, save the AccessKey ID and AccessKey secret of the RAM user.

  2. To grant permissions to the RAM user, perform the following steps:

    1. Go to the Users page, find the RAM user that you created, and then click Add Permissions in the Actions column.

    2. Search for AliyunKvstore in the Policy search box and select the AliyunKvstoreFullAccess policy.

      Note

      In this example, the AliyunKvstoreFullAccess policy is used for demonstration purposes. This policy grants full permissions to query and modify ApsaraDB for Redis instances.

      In actual projects, you can select policies as needed or customize more fine-grained policies. For more information, see Identity management.

    3. Click Grant permissions.

Procedure

  1. Go to the Create Stack page in the ROS console.

    In this example, a ROS template is added to the sample file. You can make the following configurations:

    (Optional) View the JSON-formatted template for this example.

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Description": {
        "en": "Create the Redis instance, and create a new database account.",
         
      },
      "Parameters": {
        "ZoneId": {
          "Type": "String",
          "Description": {
             
            "en": "Before you create an instance, confirm that the Availability Zone supports the specifications of Redis resources."
          },
          "AssociationProperty": "ALIYUN::ECS::Instance:ZoneId",
          "Label": {
            "en": "Zone ID",
             
          }
        },
        "VpcId": {
          "Type": "String",
          "Label":{
             
            "en":"VPC ID"
          },
          "AssociationProperty": "ALIYUN::ECS::VPC::VPCId"
        },
        "VSwitchId": {
          "Type": "String",
          "Label": {
            "en": "VSwitch ID",
             
          },
          "AssociationProperty": "ALIYUN::ECS::VSwitch::VSwitchId",
          "AssociationPropertyMetadata": {
            "VpcId": "${VpcId}",
            "ZoneId": "${ZoneId}"
          }
        },
        "AccountName":{
          "Type":"String",
          "Label":{
             
            "en":"Account"
          },
          "Default":"ros_user"
        },
        "AccountPassword":{
          "Type":"String",
          "Label":{
             
            "en":"Account Password"
          }
        }
      },
      "Resources": {
        "RedisInstance": {
          "Type": "ALIYUN::REDIS::Instance",
          "Properties": {
            "VpcId": {
              "Ref": "VpcId"
            },
            "VSwitchId": {
              "Ref": "VSwitchId"
            },
            "InstanceName": "ros_example",
            "InstanceClass": "tair.rdb.with.proxy.1g",
            "ShardCount": 2,
            "ZoneId": {
              "Ref": "ZoneId"
            }
          }
        },
        "Account": {
          "DependsOn":[
            "RedisInstance"
          ],
          "Type": "ALIYUN::REDIS::Account",
          "Properties": {
            "AccountDescription": "Test Create Redis Account",
            "InstanceId": {
              "Ref": "RedisInstance"
            },
            "AccountType": "Normal",
            "AccountName": {
              "Ref":"AccountName"
            },
            "AccountPrivilege": "RoleReadWrite",
            "AccountPassword": {
              "Ref":"AccountPassword"
            }
          }
        }
      },
      "Outputs": {
        "InstanceId": {
          "Value": {
            "Fn::GetAtt": [
              "RedisInstance",
              "InstanceId"
            ]
          }
        },
        "AccountName": {
          "Description": {
             
            "en": "Account"
          },
          "Value": {
            "Ref": "AccountName"
          }
        }
      }
    }
  2. In the top navigation bar, select a region.

  3. On the Create Stack page, enter a stack name.

  4. Configure the following template parameters. Use the default values for other parameters. For more information about how to create a stack, see Use a ROS template to create a stack.

    1. Select a zone, a virtual private cloud (VPC), and a vSwitch.

    2. Enter the name of the account that you want to create and the account password.

  5. Click Next.

    The order information and estimated costs are displayed on the page. In this example, a pay-as-you-go Tair DRAM-based cluster instance is created. The instance has 2 GB of memory and contains two shards.

  6. Confirm the order information and click Create.

    When the status changes to Created on the Stack Information tab, the task is completed.

  7. After the stack is created, click the Outputs tab to view the ID of the new instance and the account name.

    image

    You can call an API operation, use an SDK, or log on to the ApsaraDB for Redis console to view the newly created instance.

What to do next

For information about how to release a pay-as-you-go instance, see Release pay-as-you-go instances.