Before you start to use ApsaraDB for RDS, you must create a database and account for an RDS instance. This topic describes how to create a database for an ApsaraDB RDS for PostgreSQL instance.

Terms

  • Instance: a virtualized database server, on which you can create and manage multiple databases.
  • Database: an organized collection of data that can be shared or accessed by different users. The data in a database is stored with minimal redundancy and is independent of applications.
  • Character set: a collection of letters and special characters and their encoding rules used in a database.

Precautions

  • You can create and manage databases for an ApsaraDB RDS for PostgreSQL instance with standard SSDs in the ApsaraDB for RDS console.
  • You can create and manage databases for an ApsaraDB RDS for PostgreSQL instance with local SSDs through SQL statements.
  • To migrate an on-premises database to an ApsaraDB for RDS instance, you must create a database and an account for the instance consistent with those for the on-premises database.

For an ApsaraDB RDS for PostgreSQL instance with standard SSDs

  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.
    Select a region
  3. Find the target instance and click its ID.
  4. In the left-side navigation pane, click Databases.
  5. Click Create Database.
  6. Configure the following parameters.
    Create a database
    Parameter Description
    Database 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 Sets The character set that is supported by the database.
    Collate The sorting rules of strings.
    Ctype The type of characters.
    Authorized Account The database owner, who has all permissions on the database.
    Description The description of the database.
  7. Click Create.

For an ApsaraDB RDS for PostgreSQL instance with local SSDs

  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.
    Select a region
  3. Find the target instance and click its ID.
  4. In the upper corner of the page, click Log On to DB to go to the RDS Database Logon page.
  5. Configure the following parameters.
    Log on to DMS
    Parameter Description
    Network address:Port The endpoint and port information to connect to the RDS instance. For more information, see View and change the internal and public endpoints and ports.
    Database Username The username of the account used to access the database.
    Password The password of the account used to access the database.
  6. Click Log On.
    Note If the system prompts you to add the CIDR block of the DMS server to the RDS whitelist, click Configure Whitelist.
  7. After you have logged on to the RDS instance, choose SQL Operations > SQL Window in the top navigation bar.
  8. In the SQL window, execute 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, execute the following statement.

    CREATE DATABASE test;

What to do next

Connect to an ApsaraDB RDS for PostgreSQL instance.