Before you start to use ApsaraDB for RDS, you must create a database and account for the RDS instance.

  • For instances of ApsaraDB RDS for PostgreSQL 11 Cluster Edition (Standard SSD) and PostgreSQL 10 Cluster Edition (Standard SSD), you can directly create and manage databases in the ApsaraDB for RDS console.
  • For instances of ApsaraDB RDS for PostgreSQL 10 Cluster Edition (Local SSD), PostgreSQL 10 Basic Edition, and PostgreSQL 9.4, you need to create and manage databases through the Data Management Service (DMS) console or other remote management tools.

Notes

  • Databases within the same instance share all the resources of the instance. You can create multiple databases for each ApsaraDB RDS for PostgreSQL instance. You can also use SQL commands to create and manage databases.
  • To migrate the on-premises database to ApsaraDB for RDS, you must create a database and account in the RDS instance consistent with those in the on-premises database.

For PostgreSQL 11 Cluster Edition (Standard SSD) and PostgreSQL 10 Cluster Edition (Standard SSD)

  1. Log on to the ApsaraDB RDS for PostgreSQL console.
  2. In the upper-left corner of the page, select the region where the instance is located.

  3. Find the instance and click the instance ID.
  4. In the left-side navigation pane, click Databases.
  5. Click Create Database.
  6. Configure the following parameters.
    Parameter Description
    Database (DB) name
    • The name can be up to 64 characters in length.
    • It can contain lowercase letters, digits, underscores (_), and hyphens (-).
    • It must start with a letter and end with a letter or digit.
    Supported character set The character set that is supported by the database.
    Collate The sorting rules of strings.
    Ctype The type of characters.
    Database owner The database owner, who has all permissions on the database.


  7. Click OK.

For PostgreSQL 10 Cluster Edition (Local SSD), PostgreSQL 10 Basic Edition, and PostgreSQL 9.4

  1. Log on to the ApsaraDB for RDS console.
  2. In the upper-left corner of the page, select the region where the instance is located.

  3. Find the instance and click the instance ID.
  4. In the upper-right corner of the page, click Log On to DB to enter the Quick Logon page of the DMS console.
  5. On the Quick Logon page, check the endpoint and port information displayed on the RDS Database Logon page. If the information is correct, enter the username and password of the database, as shown in the following figure.

    Parameter Description
    Network address: port The endpoint and port information to connect to the RDS instance.
    Database username The username of the account used to access the database.
    Password The password of the account used to access the database.
  6. If the system prompts you to add the IP CIDR block of the DMS server to the RDS whitelist, click Configure Whitelist. For more information about how to manually configure the whitelist, see Configure a whitelist.
  7. After the whitelist is configured, click Log On.
  8. After you have logged on to the RDS instance, in the top navigation bar, choose SQL Operations > SQL Window.
  9. In the SQL window, run the following statement to create a database:
    CREATE DATABASE name
     [ [ WITH ] [ OWNER [=] user_name ]
            [ TEMPLATE [=] template ]
            [ ENCODING [=] encoding ]
            [ LC_COLLATE [=] lc_collate ]
            [ LC_CTYPE [=] lc_ctype ]
            [ TABLESPACE [=] tablespace_name ]
            [ CONNECTION LIMIT [=] connlimit ] ]

    For example, if you want to create a database named test, run the following command.

    create database test;
  10. Click OK.