Simon ‘Geosmiles’ Miles
3 min readJan 18, 2021

--

Setting up a Postgres instance in LightSail

If you’ve not done so already create yourself an AWS account for which you’ll need payment details for. It’s fairly painless!

Once you’ve logged in, go to Services, find Compute and click on LightSail. You’ll be taken to a new browser tab, dedicated to LightSail.

I’m sure that you’ll want to explore what LightSail has to offer, so once you’ve done exploring click on Databases and then the Create database button on the right of the screen.

This is where we setup the database. If you want to change your default Region then do so, otherwise leave it as it is.

You have a choice of MySQL or PostgreSQL — given this post is about setting up Postgres, I would opt for this. There are a few versions available, so unless you need a specific version I would opt for 12.4.

Scroll down the page and then set the plan that you want. Normally cheap = crap quality but not in this case. I can safely say that I’ve never opted for anything other than a $15 plan and its served me well.

Scroll down some more and then give your database a name and if you are so inclined perhaps some tags, just so that you can identify what the database is being used for. Once done, click create database and wait no more than 5 minutes for the database to be created.

Once created and running, you’ll see the database listed under the database tab. In the below screenshot you’ll see that I’ve got two Postgres databases running in LightSail. Click on the Kebab Menu (three vertical dots) and click on Manage.

Once ‘inside’ your database settings you can access the user name and password for the database. During the setup you have the option to set the username and password, which I glossed over, so you’ll see the default username of dbmasteruser.

Under the Connect tab you’ll also see the Endpoint of the database. This is the Host value when you come to create a connection to the database.

So that you can access the database, click on the Networking tab and click on the Public mode, so that it is enabled. This makes accessing the database a lot easier.

And that’s it, in 8–9 clicks you have a postgres database setup and ready for action.

I use a mixture of Dbeaver and PGAdmin4 to manage my postgres databases. Dbeaver has an issue whereby you can’t create a new database within Postgres, while in PGAdmin4 you can! Just so that you are aware.

--

--