/wms-serverless

A Serverless implementation of WMS on AWS

Primary LanguageHCL

WMS Serverless

A Serverless implementation of WMS on AWS.

This repository contains a terraform project that implements a serverless version of WMS on AWS.

A live demo can be found here: https://nathancalandra.cloud/goes16-serverless

Components

This project consists of three modules.

S3

This modules contains the main S3 bucket used in this project. It's purpose is store layers that will be served by the API. The data source module can be used to automatically add files to this bucket. To prevent storing large amounts of data, a life-cycle policy is applied to delete any object older than one day.

NetCDF Data Source

This module contains lambda functions and an SNS subscription that are used to convert NetCDF files on the noaa-goes16 public S3 bucket to COGs. It can be configured to pull as much data as desired from the source bucket. It's default configuration pulls a single product. To add more products edit the data_definitions variable in terraform/main.tf. For example, the following configuration processes bands 2 and 9 from the Cloud Moisture Imagery (CMI) product. See the documentation on the public goes16 S3 bucket for a description of the available data.

[{
  filter_regex   = "ABI-L2-CMIPF\\/[0-9]{4}\\/[0-9]{3}/[0-9]{2}/OR_ABI-L2-CMIPF-M6C09.*.nc"
  parameter_name = "CMI"
  band           = 1
}, {
  filter_regex   = "ABI-L2-CMIPF\\/[0-9]{4}\\/[0-9]{3}/[0-9]{2}/OR_ABI-L2-CMIPF-M6C02.*.nc"
  parameter_name = "CMI"
  band           = 1
}]

WMS API

The WMS API module uses API Gateway and lambda functions to operate on files stored in the S3 bucket. Currently there are two endpoints:

wms

This is endpoint supports a partial implementation of the WMS "GetMap" request.

Supported parameters:

Name Supported (yes/no) Notes
VERSION yes Only 1.3.0
REQUEST yes Only "GetMap"
LAYERS yes Only one layer at a time
STYLES yes Name of a csv file in the cog renderer lambda function
CRS no
BBOX yes
WIDTH yes
HEIGHT yes
FORMAT yes Only PNG
TRANSPARENT yes
BGCOLOR no
EXCEPTIONS no
TIME no
ELEVATION no

layers

This endpoint simply lists layers in the main S3 bucket. It is a placeholder until WMS "GetCapabilities" is supported.

Installation

  1. Install terraform
  2. Open a terminal inside the terraform directory
  3. Run terraform init
  4. Provide variables for s3 backend storage
  5. Run terraform apply

AWS Services used by this project

Lambda, GDAL, and Python

https://github.com/developmentseed/geolambda