Ed note: This is a guest post written by Dave Townsend, a Principal Software Engineer at Matson. Check out the on-demand webinar, “Charting a Course for Serverless with Matson,” with Dave, AWS Principal Developer Advocate Chris Munns, and IOpipe CTO/Co-founder Erica Windisch. View here: https://www.iopipe.com/serverless-webinars/logistics-serverless-webinar-series-matson-aws-iopipe/.

The Voyage Begins

After completing a 10-year effort to migrate systems from mainframe to a modern Java stack in 2015, Matson, Inc., a 135-year-old leading U.S. shipping carrier in the Pacific, spent the next year closing four internal data centers and moving operations to AWS. It was a tour de force year, to say the least.

Announced at the 2016 AWS re:Invent conference, going “all-in” on the AWS cloud, completed the first leg of Matson’s cloud-native voyage. With the data-center “lift-and-shift” now behind us, a focus on innovation and digital transformation could begin.

First Sight of Lambda

Like many, I was intrigued with AWS Lambda functions from the initial announcement at re:Invent 2014, but did not do much with them right away. Meanwhile, Matson’s Innovation & Architecture team, of which I am part, was starting to make heavy use of Amazon EC2 in our lab account for experimentation and running proofs of concept. This of course came with a nicely- sized monthly bill.

To automate the scheduling of Amazon EC2 instances to be available only during business hours, was a low-risk opportunity to start experimenting with AWS Lambda functions, which turned out to be a valuable, zero-cost solution.

Additionally, we integrated some Amazon API Gateways to provide our offshore contract team with a simple, secure way to stop/start servers without creating additional AWS user accounts.

The outcome of this experimentation yielded two positive results:

Monthly savings on our Amazon EC2 spend (the desired result) We realized the benefits of a serverless approach, and became very excited about the possibilities of serverless computing for the wider Matson enterprise (bonus)

Set a Course for Serverless

One of the Innovation & Architecture team’s responsibilities is leading mobile product development. At the start of 2017, we were presented with an opportunity to build a flagship mobile application for global container tracking, along with a few additional value-adds such as interactive vessel schedules, location-based port maps, and live gate camera feeds.

With the known spiky traffic patterns from our web-based online tracking system, building the mobile back-end as a highly-available, (with a likely low total cost of ownership), serverless solution was a perfect fit.

Architecture Overview

All mobile device access into the system is via Amazon API Gateway. Using Amazon API Gateway ensures that we have a highly-available and scalable set of endpoints for mobile access across the U.S. We also do a fair amount of caching in this service.

Much of the data needed for the app is available in a set of existing business APIs within our Amazon VPC. Some of these APIs are not entirely mobile-friendly. AWS Lambdas provide a great place to perform any needed data transformations for optimizing mobile payloads.

The AWS Lambda functions are architected as microservices, with each service having a bounded-context for a given business function, e.g., tracking service, vessel service, etc.

Amazon DynamoDB is used primarily to externalize environment configuration for both the mobile devices and the internal system.

High Level Architecture