Configure incoming connections of a Public Cloud Databases for Valkey service
Find out how to configure your Valkey service to accept incoming connections
Objective
Public Cloud Databases allow you to focus on building and deploying cloud applications while OVHcloud takes care of the database infrastructure and maintenance in operational conditions.
This guide explains how to configure your Valkey instance to accept incoming connections.
Requirements
- A Public Cloud project in your OVHcloud account
- A Valkey service running on your OVHcloud Public Cloud Databases (this guide can help you to meet this requirement)
OVHcloud Control Panel Access
- Direct link:
- Navigation path:
Public Cloud> Select your project >Databases
Instructions
Configure your Valkey instance to accept incoming connections
Before making a connection, we need to verify that our Valkey instance is correctly configured.
Click on Databases in the left-hand navigation bar and select your Valkey instance.
Step 1: Verify your user roles and password
Select the Users tab. Verify that you have a user with sufficient rights and a password. A default user exists on every new service.
The password of a user is displayed only once, when the user is created, and cannot be retrieved later. If you don't remember the user's password, you can either create a new user or regenerate the password of an existing user: click on the ... button on the right of the user, then on Reset password. Be careful! By doing so you will need to update all the places where you already use this user/password pair.
To create a new user, click on Add user, fill in the form, then click on Create User. Apart from Username, each field accepts several values:
- Username: the name of the user.
- Keys: the key patterns the user can access, for example
cache:*. - Categories: the command categories allowed (
+) or denied (-), for example+@read,+@write,+@connection. - Commands: individual commands allowed (
+) or denied (-), for example-flushall. - Channels: the pub/sub channel patterns the user can access, for example
news:*.
In our example, we create a user called app-user with the following rights:
- Keys:
cache:*(only keys starting withcache:)
- Categories:
+@read(read commands)+@write(write commands)+@connection(connection commands such asPING,HELLOorAUTH)+@pubsub(pub/sub commands, needed in addition to a channel pattern to publish or subscribe)
- Commands:
-flushall(forbids theFLUSHALLcommand)
- Channels:
news:*(only channels starting withnews:)
With these rights, any access to a key outside cache:* is refused with the error NOPERM No permissions to access a key.
Once created or updated, the user must have the READY status in the OVHcloud Control Panel.
To change the rights of an existing user, click on the ... button on the right of the user, then on Edit. The new rights apply immediately, without reconnecting. You can also manage them with the API.
Follow the Valkey ACL documentation and the Valkey commands documentation to learn more.
Follow this guide to learn more about users and roles capabilities and limitations.
Step 2: Authorise incoming connections from the service
For security reasons the default network configuration doesn't allow any incoming connections. It is thus critical you authorise the suitable IP addresses in order to successfully access your database.
Select the Configuration tab, then locate the IPs section. IP addresses must be authorised here before they can connect to your database.
Enter an IP address or a CIDR block in the IP address or IP/mask field, add a description to identify its origin, then click on Add. In our example, we enter 203.0.113.10/32. The Current IP shortcut adds the public IP address from which you are browsing the OVHcloud Control Panel.
Click on Save changes to apply your changes. You can remove an authorised IP from the same section, then save your changes.
You can enter 0.0.0.0/0 to allow connections from any address. Your service then becomes reachable from the entire Internet, and only the username/password pair protects your data. Please use it carefully.
Collect required information
Select the Dashboard tab to find the connection details in the Connection information section: host, port and service URI.
The URI has the form valkeys://<username>:<password>@<host>:<port>. TLS is mandatory: connections without TLS are refused. The server certificate is signed by a public certification authority, so you do not need to download a CA certificate to connect.
Select the Users tab to get the username.
Go further
Visit our dedicated Discord channel: https://discord.gg/ovhcloud. Ask questions, provide feedback and interact directly with the team that builds our databases services.
For training or technical assistance implementing our solutions, contact your sales representative or visit our Professional Services page to request a quote and have your project analysed by our experts.
Join our community of users.