Help Center/ Relational Database Service/ Getting Started/ Getting Started with RDS for PostgreSQL/ Buying an RDS for PostgreSQL Instance and Connecting to It Through DAS
Updated on 2025-01-10 GMT+08:00

Buying an RDS for PostgreSQL Instance and Connecting to It Through DAS

This section describes how to purchase an RDS for PostgreSQL instance and how to connect to it using DAS.

Step 1: Buy an RDS for PostgreSQL DB Instance

  1. Go to the Buy DB Instance page.
  2. On the Quick Config page, set basic parameters.

    The following parameter settings are only for reference.

    Parameter

    Example Value

    Description

    Billing Mode

    Pay-per-use

    The billing mode of an instance.

    • Yearly/Monthly: A prepaid billing mode in which you pay for resources before using it. Bills are settled based on the subscription period. The longer the subscription, the bigger the discount. This mode is a good option for long-term, stable services.
    • Pay-per-use: A postpaid billing mode. You pay as you go and just pay for what you use. The DB instance usage is calculated by the second but billed every hour. This mode allows you to adjust resource usage easily. You neither need to prepare for resources in advance, nor end up with excessive or insufficient preset resources.

    Region

    CN-Hong Kong

    The region where your resources are located.

    NOTE:

    Products in different regions cannot communicate with each other through a private network. After a DB instance is created, the region cannot be changed. Therefore, exercise caution when selecting a region.

    DB Engine Version

    16

    The database version.

    DB Instance Type

    Primary/Standby

    The architecture type of an instance.

    Primary/Standby: An HA architecture. In a primary/standby pair, each instance has the same instance class. When a primary instance is being created, a standby instance is provisioned along with it to provide data redundancy. The standby instance is invisible to you after being created.

    Instance Class

    General-purpose | 4U | 8G

    The vCPU and memory of an instance.

    Storage

    Cloud SSD | 100GB

    The storage space of an instance.

    It contains the system overhead required for inodes, reserved blocks, and database operation.

    Disk Encryption

    Disable

    Enabling disk encryption improves data security, but slightly affects the read and write performance of the database.

    If a shared KMS key is used, the corresponding CTS events are createdatakey and decrydatakey. Only the key owner can receive the events.

  3. Complete advanced configurations.
    Figure 1 Additional Options

    Parameter

    Example Value

    Description

    VPC

    default_vpc

    The virtual network in which your instance is located. A VPC can isolate networks for different workloads.

    If no VPC is available, click Create VPC. After a VPC is created, click . For details, see Creating a VPC and Subnet.

    Subnet

    default_subnet

    A subnet provides dedicated network resources that are logically isolated from other networks for network security.

    Security Group

    default

    It can enhance security by controlling access to RDS for PostgreSQL from other services.

    Enterprise Project

    default

    If your account has been associated with an enterprise project, select the target project from the Enterprise Project drop-down list.

    For more information about enterprise projects, see Enterprise Management User Guide.

    Quantity

    1

    The number of instances to be created in a batch.

  4. Click Buy.
  5. Check the purchased DB instance.
    Figure 2 Instance successfully purchased

Step 2: Connect to the RDS for PostgreSQL Instance

  1. Since no password is configured in Step 1: Buy an RDS for PostgreSQL DB Instance, you need to reset the password before you can connect to the instance. In the instance list, choose More > Reset Password.
    Figure 3 Instance list
  2. Enter a new password, confirm the password, and click OK.
    Figure 4 Resetting a password
  3. Click Log In in the Operation column.
    Figure 5 Instance list
  4. Enter the required information and click Log In.
    • Login Username: Enter root.
    • Database Name: Enter postgres.
    • Password: Enter the password you specified in 2.
    Figure 6 Logging in to an instance
  5. Choose SQL Operations > SQL Query.
    Figure 7 SQL Query
  6. Create a database named test1.

    CREATE DATABASE test1;

    Figure 8 Creating a database
  7. Switch to test1 and create a schema named schema1 in the database.
    Figure 9 Switching to the database

    CREATE SCHEMA schema1;

    Figure 10 Creating a schema
  8. Switch to schema1 and create a table named mytable with only one column. Specify the column name as firstcol and the column type as integer.

    CREATE TABLE schema1.mytable (firstcol int);

    Figure 11 Creating a table
  9. Insert data to the table.

    INSERT INTO schema1.mytable values (100);

    Figure 12 Inserting data

    Query data in the table.

    SELECT * FROM "schema1"."mytable"

    Figure 13 Querying data
  10. In the upper part of the page, choose Account Management > Role Management.
    Figure 14 Role management
  11. Click Create Role and complete basic settings. user1 is used as an example.
    Figure 15 Creating a role
  12. Click the Permissions tab and grant user1 the permissions to perform operations on databases, schemas, and tables.
    Figure 16 Granting permissions
  13. On the Development Tool page, click Add Login and log in to the database as user1.
    Figure 17 Adding login
  14. Create schema2 in test1 to verify that user1 has the CREATE permission.
    CREATE SCHEMA schema2;
    Figure 18 Verifying permissions