This blog post is a series of 3, our aim is to walkthrough the set-up of your PostgreSQL service on a Kyma environment:
In this article we will cover how to connect to your PostgreSQL instance on the Kyma environment
Before connecting to your PostgreSQL instance there are some prerequisites and steps that need to be carried out:
In order to connect to a PostgreSQL instance you need to access the instance credentials and URI (Uniform Resource Identifier), you can extract this information from your binding.
Within your Kyma dashboard you can access the ‘URI’ and ‘Secret’ of your PostgreSQL instance. Navigate to your service binding (1) and select the service binding name hyperlink (2)Select the ‘Secret Name’ (3) where you will have the ‘URI’ and credentials to access your PostgreSQL instance.Select the decode (4) button to see the values decoded, you will need them for the following steps.
Allowing your IP address to be used for connection
To connect to your PostgreSQL your IP address needs to be added as a value to the instance parameter ‘allow-access’. Using Kyma dashboard you can navigate to your ‘Service Instance’ and select ‘Edit’.Within the ‘Instance Parameters’ section add the parameter ‘allow_access’ (string format), followed by your IP address, after selecting ‘Update’ a success message should be displayed with ‘Service Instance Updated’.
If you wish to consume a PostgreSQL instance through an application using Kyma please additionally add the Cluster NAT IPS to your ‘allow_access’ parameters.
To obtain the cluster NAP IPs please follow the guidelines provided within the following Kyma documentation.
Once you have your cluster IP address add it to the allow-access parameters within your PostgreSQL instance as you did above for your own IP.
Now that you have successfully allow listed your IP you can connect to your PostgreSQL instance.
Using psql to connect to the instance, open your terminal window (psql) and execute the below command using your decoded URI information as a parameter.
Once connected successfully, test your PostgreSQL connection by verifying your PostgreSQL instance version for example.
Your PostgreSQL version will be displayed.
Alternatively, you can use the GUI tool pgAdmin 4 to test your connection, for that you need to register your server.
Once connected successfully, test your PostgreSQL connection by using the query tool and verify for example the list of all databases in your PostgreSQL instance using the below SELECT statement.
Congratulations! You have now successfully connected to your PostgreSQL instance and are ready to start using it for your development.
Relevant sources of information:
Please check out the blog post below, where we've shared a list of key topics from the product team.
Thank you,
SAP BTP Backing Services – Product Management
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
14 | |
12 | |
11 | |
11 | |
9 | |
9 | |
9 | |
8 | |
7 | |
6 |