LightSail & GIS

Simon ‘Geosmiles’ Miles
4 min readJan 2, 2021

Amongst many things in life, I like maps, data and messing around with tech. In this post I wanted to introduce you to LightSail and why it could change how you share GIS data.

LightSail is a little gem of AWS which not so many people are aware of and perhaps I am letting the cat out of the bag with this post! As an umbrella term, LightSail is actually a series of fast, reliable and easy to setup Cloud services which allows users to ‘spin up’ servers built on either Windows or Linux . It also allows you to launch applications such as wordpress or development stacks like Node JS or PHP.

But most importantly for me, and the point of this post, is it allows you to ‘spin up’ databases, namely MySQL and PostgreSQL.

Click, Click, Click…

I’ve not actually counted the number of clicks it takes to launch a Postgres instance in Lightsail but it’s not all the many.

Thinking allowed: write a post on actually setting up a Postgres LightSail instance(inc. notes on SQL and PGAdmin4.).

Once you hit the final button to create the Postgres instance, then it's just a matter of waiting for the databases to be ready to use. Something in the region of 5 minutes. The most important thing to do once created is it make sure that you make the database public. This means that anyone, anywhere can access to the database, as long as they have its details. Yes, I can hear some of you taking a sharp intake of breath but just go with it, for now! Restricting access via IP address is getting there for LightSail but it's not all there yet. (https://aws.amazon.com/blogs/compute/enhancing-site-security-with-new-lightsail-firewall-features/)

Joining the dots:

I am all in on cloud technologies. It makes life easier to share ‘things’ (data, files and thoughts). That being the case, I still have a Windows desktop PC on which I have installed my GIS of choice: QGIS and two database GUIs, PGadmin4 and Dbeaver.

Thinking allowed: write a post on PGadmin4 Vs Dbeaver.

Using PGadmin4 connect to the Postgres instance and simply running a few SQL commands to make a new database instance and enable it to work with GIS data. In reality this means running a command to create a new database (don’t use the default Postgres database), initiate the Postgres extension PostGIS, and also add into a few users (if needed).

Add in the Postgres connection details into QGIS and now I can access my data GIS on my PC, Laptop, even my iPad. I can edit data anywhere I like; under the duvet, at my desk, on the sofa, on the train or in the middle of nowhere (subject to 4G coverage).

Thinking allowed: write a post on ways of sharing PostGIS data in QGIS with users

Ok, some of you might be thinking that I could have simply used GeoPackages or SHP files stored in Box or Dropbox to allow for remove access to data. However in practice I’ve had syncing issues leading to versioning issues and in some instances even corrupting my data.

The Cost:

LightSail is cheap. Far cheaper than its bigger brother (RDS), so for as little as $15 a month, I can do rather a lot with even the smallest of LightSail plans. What this means in practice is that for projects that need me to share data, or do some mobile mapping then for a small monthly cost I can ‘spin up’ for a month, or two or even less a Postgres instance to capture data. Once the project is done, or the need for Postgres no longer exists then I take a backup of the data into a GeoPackage and stop the Postgres instance. Or if I wanted, could do a PG dump and restore the dump in my own local copy of Postgres.

Why not use AWS RDS (relational database service)?

Well I do use RDS services, more because actually I didn't know about the existence of LightSail when I setup my Postgres instances. The main difference between RDS and LightSail is the extra layers of security that RDS offers. Without going into too much detail, an RDS instances sits within its own Virtual Private Cloud (VPC), for which you can add all manner of security access to, such as limiting which IP addresses can access the RDS. LightSail has something similar but far, far less safficicated.

Beyond GIS:

While I must admit that my world revolves around visualising location based data, aka GIS; there are other ways that I like to access/share/display data that LightSail is also great for.

For instance I’ve got a NodeJS instance running in LightSail as well. I’ve created Restful APIs and CRUD applications using Express to read/write data to LightSail Postgres instances.

I’ve also used AWS Lambda to connect to LightSail Postgres instances to create APIs via the AWS API gateway.

Thinking allowed: write a post on what I’ve done with NodeJS on LightSail.

In Summary:

If you want to share data, without the complication that RDS brings and you want to access your data from anywhere, then LightSail Postgres might be the answer for you.

LightSail is cool and very much underestimated as a means to create applications and instances.

--

--