How to get a free PostgreSQL database in the Cloud

Toni Soueid
4 min readJan 21, 2023

--

Hi and welcome to my blog.

Today I want to show you a website that allows you to get your own PostreSQL database accessible from the Internet.

You might be wondering why you might need to use such a service when you can simply install PostgreSQL on your PC and use it.

Well, this would be a valid option if what you need is local access to the database from within your local network. But when you need to access those databases from the public Internet (from a SaaS tool for example) then things get a little complicated for using your local database server.

One could provision a PostgreSQL database on one of the three major cloud providers (Amazon Web Services, Microsoft Azure or Google Cloud Platform) but those providers will bill you by the hour and this would be a really expensive option for many of us who just want a Postgres database to play with.

This is where the service I will demonstrate to you today really shines and comes in very handy when you need a free database.

I’m convinced, show me the service

The service I will be talking about today are is called “ElephantSQL”

Why did I choose to show you this service ? Simply because they truely offer access to free PostgreSQL databases hosted and managed by their teams. These databases never expire and are never decomissioned (at least at the time of writing this article).

ElephantSQL (www.elephantsql.com) describe themselves as a “PostgreSQL as a Service” provider. As their tagline suggests they only provide PostgreSQL databases.

Screenshot of ElephantSQL.com homepage

Before being able to request a PostreSQL database you will need to register on their website by following this link: https://customer.elephantsql.com/signup.

Once you provide a valid email address and verify it, you are ready to go.

Click on “create new instance” button to request a PostgreSQL instance

ElephantSQL offer many PostgreSQL hosting plans, all of them are paid options except one called “TinyTurtle”.

This micro database offering comes with some limitations as can be seen in the below screenshot.

The “TinyURL” offering allows you only store 20 MB worth of SQL data

But this offering is most of the time enough for our testing purposes (at least for my use cases it is completely acceptable).

Now, let’s see how we can provision a “TinyTurtle” instance.

Simply click on “Create New Instance” and follow the steps of the instance provisioning wizard.

ElephantSQL instance provisionning wizard screenshot

You will need to provide a name for your database and select an Amazon Web Services region where it will be hosted.

Once you click on “Create Instance” your database is provisioned and ready to use.

Screenshot of database details and connection settings

Connecting to your newly created database

You can connect to your ElephantSQL database from any tool or piece of code you might be writing.

For the purpose of illustrating this here in this blog, I will use the free pgAdmin tool that I have already installed on my PC.

If you don’t have pgAdmin you can get an installation package for your operating system from the following link www.pgadmin.org

In pgAdmin you will need to add a connection to a new server and use the connection settings that ElephantSQL provided you.

Once connected to the PostgreSQL server you might need to scroll in the “Databases” tree hierarchy on the left and select the name of the database assigned to you by ElephantSQL (your database is hosted on a shared PostgreSQL server for obvious cost optimization reasons).

Screenshot of pgAdmin tool connected to our ElephantSQL database

Once you have selected your database, you can right-click on it and select the “Query Tool”.

All you have to do now is enjoy typing SQL statements and see them get executed against your database.

Here are my example statements to confirm my database is working well:

CREATE TABLE CUSTOMER(Id int, Name varchar(50))

INSERT INTO CUSTOMER VALUES (1, 'ACME Corp')
INSERT INTO CUSTOMER VALUES (2, 'NorthStar Corp')

SELECT * FROM CUSTOMER

If all went well you should see an output like below.

pgAdmin Query Tool screenshot

In Conclusion

In this article I have showed you how you can get a free Internet accessible PostgreSQL database. Enjoy using your new database and practicing your SQL skills.

--

--

Toni Soueid
Toni Soueid

Written by Toni Soueid

IT Solution Architect with 20 years of experience in software and systems architecture. I currently have very strong interests in Cloud & Low-Code technologies.

Responses (4)