How to Manage Trusted Sources for Vultr Managed Databases for PostgreSQL

Updated on September 25, 2024

Trusted sources allow you to restrict access to your managed databases by specifying the list of IP addresses that can securely connect to the database instance. This security mechanism reduces the risk of unauthorized access by preventing DDoS and brute-force attacks. Trusted sources work on top of other security measures like user access control.

Follow this guide to manage trusted sources for Vultr Managed Databases for PostgreSQL using the Vultr Customer Portal, API, and CLI.

  • Vultr Customer Portal
  • Vultr API
  • Vultr CLI
  1. Navigate to Products and select Databases.

  2. Click the target managed database instance.

    Select Managed Database

  3. Navigate to Trusted Sources under Overview and click Edit.

    Edit Trusted Sources

  4. Specify a list of the IP addresses of the servers that you want to allow to connect to the database and click Save.

    Add Trusted Sources

  1. List all the database instances by sending a GET request to the List Managed Databases endpoint and note the database ID. For example, 43b4c774-5dff-4ac0-a01f-78a23c2205b5.

    console
    $ curl "https://api.vultr.com/v2/databases" \
        -X GET \
        -H "Authorization: Bearer ${VULTR_API_KEY}"
    
  2. Send a PUT request to the Update Managed Database endpoint to define the IP addresses of the servers that you want to allow to connect to the database in array format and specify the database ID.

    console
    $ curl "https://api.vultr.com/v2/databases/database_id" \
        -X PUT \
        -H "Authorization: Bearer ${VULTR_API_KEY}" \
        -H "Content-Type: application/json" \
        --data '{
            "trusted_ips" : ["192.0.2.1","192.0.2.2","192.0.2.3"]        
        }'
    

    Visit the Update Managed Database endpoint to view additional attributes to add to your request.

  1. List all database instances and note the database ID. For instance, d6ac2a3c-92ea-43ef-8185-71a23e58ad8c.

    console
    $ vultr-cli database list --summarize
    
  2. Define the IP addresses of the servers that you want to allow to connect to the database (For instance, 192.0.2.1,192.0.2.2,192.0.2.3) and specify the database ID.

    console
    $ vultr-cli database update database_id \
    --trusted-ips "192.0.2.1,192.0.2.2,192.0.2.3"
    

    Run vultr-cli database update --help to view all options.