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 MySQL using the Vultr Customer Portal, API, and CLI.
Navigate to Products and select Databases.
Click the target database instance.
Navigate to Trusted Sources under Overview and click Edit.
Specify a list of the IP addresses of the servers that you want to allow to connect to the database and click Save.
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
.
$ curl "https://api.vultr.com/v2/databases" \
-X GET \
-H "Authorization: Bearer ${VULTR_API_KEY}"
Send a PUT
request to the Update Managed Database endpoint to add the IP addresses of the servers that you want to allow to connect to the database in array format and specify the database ID.
$ 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.
List all database instances and note the database ID. For instance, d6ac2a3c-92ea-43ef-8185-71a23e58ad8c
.
$ vultr-cli database list --summarize
Add 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.
$ 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.