Remote GIS Work with PostGIS in the Cloud

If you’re a GIS user working from home these days, you may be finding that having all your geographic data on a shared network folder in your office and connecting through a VPN is a real pain. Perhaps your company hasn’t moved you to an enterprise class geodatabase due to expense, or lack of institutional technical knowledge, or maybe you haven’t brought it up because you thought that it would be overkill for your organization’s geospatial needs. Enter PostgreSQL with PostGIS in the cloud - a low cost, scalable, geospatial powered data warehouse that your team can access from anywhere.

Hosting Options

There are a few options to host PostgreSQL for your organization in the cloud. You can use a managed service like Amazon Web Services (AWS) Relational Database Service (RDS), you could roll your own Cloud Virtual Machine using Windows and Linux and manage your PostgreSQL install yourself, or you could use any number of container services like Kubernetes to run instances. Of the three, the easiest is probably running a PostGIS engine on AWS RDS. Here at CartoLab, we use AWS RDS extensively for our own projects and our client’s projects from web map enabled applications to resilient data warehousing. 

Create a PostGIS Database on AWS RDS

Getting started with RDS is straight forward. From the Services menu look for RDS under the Database heading, select it and you’re presented with the RDS Dashboard. Next you will click on the Create Database button which will take you to a wizard where you can choose to do a Standard Creation or Amazon’s new Easy Create. 

Create a new RDS PostgreSQL instance

The Easy Create option allows you to choose your engine. Here we’re choosing PostgreSQL. If you want to try it before you buy you can use the Free Tier (which isn’t free but is much cheaper than a full instance) if it’s available to you or try a Dev/Test instance (Note: Dev/Test instances are not permanent). You could also select Production if you’re ready to go. The Easy Create setup gives you a decent instance with a lot of RAM, 2 virtual CPU’s, and half a terabyte of storage. 

Next, you will want to name your database. I suggest naming a service something meaningful. After you have named your instance, you should change your Master Username (you should never leave the main account as postgres). You can then have AWS generate a password for you or you can create your own password (Don’t use common passwords like admin).  Finally, click Create Database.

Configure PostGIS

Now that you’ve created the database, there are several configurations that will need to be managed for you to connect to it remotely with your GIS or database client. By default, outside connections to the database are not allowed. To allow remote connections, you will need to modify the databases security group to allow connections from remote IP addresses or IP ranges. After you have allowed remote access on the database you can begin creating roles and login groups, designing your schema, and loading data. 


Now that you can connect to your remote database you can add the PostGIS extension to your database. From your database client connected as a superuser (the Master Username from earlier works), simply: 

and you will now have access to all the PostGIS functions and Geometry and Geography types. If you require topology or geocoding features, there are further steps that are required that go beyond the scope of this post but are easily found in the AWS documentation.

While AWS RDS is considered a managed service, Amazon’s management of the services is fairly hands-off. It is still the responsibility of the end user or administrator to secure the instance, create proper parameters, and to install extensions correctly.  

For many users, PostGIS on the cloud can offer a very capable alternative to remote desktop connections. This just is just an introduction, and we plan on publishing more tips and tutorials in the future. If you need managed PostGIS cloud installations for your organization please contact us!

Previous
Previous

Introducing Elements: a library for rapidly building Mapbox-based web applications

Next
Next

How to Build a Coronavirus Dashboard - Part 1: Back End