Introducing Panda Sky, Severless APIs Made Easy

Panda Sky is an open source library that makes it easy to write and publish serverless APIs. Write your code, publish, and get the scale and reliablity of AWS. That cute guy up there is Ace, and he’s your co-pilot. He’s got your back.

We are really excited by the potential of serverless architectures to provide a simpler and more reliable way to deploy modern Web and mobile apps. However, serverless is still relatively new, and, like any new technology, it can be difficult to workt with. We wanted to make it easier, so we built Panda Sky.

Of course, there are other serverless frameworks out there. Sky is focused on one thing—serverless HTTP APIs on AWS—and it’s opinionated—it packages our experience and expertise in those areas. Define your API and implement your endpoints and Sky takes care of the rest, from deployment to edge-caching to custom domains to your development lifecycle.

Features

Here’s a rundown of what you get, right out of the box, if you deploy with Panda Sky:

Prerequisites

Panda Sky interfaces with your AWS account and automates complex and tedious tasks to deploy your infrastructure, but there are a couple things you need to setup first.

  1. You need have access to an AWS account and have your credentials within your Home directory (default for the AWS CLI). NEVER place your AWS credentials within your project.
  2. If you’d like a custom domain with TLS termination for your API endpoint, you need to register some things with AWS first. This guide will take you through how to set all that up.

Interface-First Design

Sky provides a Swagger-like API description format. Unlike Swagger, Sky’s format is opinionated, but it’s also simpler. You define resources and methods on those resources. Your API description lives within your project root as the file api.yaml.

Sky uses this description to automate the construction of your API and map it to your implementation code. You can also serve it up to make your API self-describing.

(Near) Real-time Publishing

Working with Sky is almost magically fast. Sky can, from simple command line invocations, deploy an API for you in 90 seconds.

asciicast
asciicast

That’s a real-time recording.

And we’re just getting started. Want to update your API code?

asciicast
asciicast

Did you get chills? I just got chills.

Custom Domains and Edge Caching

If you want to give your API endpoint a custom domain with TLS termination and edge caching, Sky has you covered there too. Sky treats that custom domain a separate resource to keep things simple and to keep the main API publish functionality ridiculously fast.

asciicast
asciicast

Full-disclosure: that recording is not real-time. Custom domains take around 30 minutes to setup because Sky is using a CloudFront distribution. That gives you edge caching, which is a Big Deal. It means any Sky API has access to Amazon’s global network of well-behaved, performant, and reliable edge servers.

Yes, 30 minutes is longer than you’d want to stare at your command line. I was the first to complain. But, Dan has since told me stories about a time when teams of humans were sent into physical rooms to deploy code to servers; that it would take all day, and sometimes it wouldn’t work, so they’d have to try again the next day. After I stopped laughing hysterically, I came to appreciate the functionality AWS offers.

And, because Sky is opinionated, it requires very little configuration from you. Let me assure you, dear reader, that CloudFront distributions are a huge pain in the ass to configure (and that’s nothing compared to the engineering feat itself of making it configurable to begin with). But, Sky takes care of it for you! Most of the time, you’ll just need to set the TTL for your cache. And when you need to invalidate your cache? Sky’s got your back there too…

sky domain invalidate [environment]

5-10 minutes later, your invalidation finishes propagating across the entire (global) network and your clients are getting the latest from your API.

No. Local. Servers.

One of the biggest stumbling blocks when adapting to serverless technology is understanding how it changes our workflow. As developers we’ve gotten used to the idea of developing against shadows of the production environment.

We jump through configuration hoops, run local databases, Docker inception, etc. And at the end of it all, there is this temptation to hand our code to DevOps professionals and proclaim:

It works on my machine.
It works on my machine.

But, that’s not distributed computing.

Even now, there are projects out there aimed at creating shadows of serverless environments, continuing that well-established pattern. But, Sky offers us a better way.

We don’t need local environments.

It takes Sky minutes to create a new API and seconds to make updates. Every developer could have their own deployed environment to work in. And we’re talking about a real environment. On the actual Internet. Responding how production would, just at smaller scale.

You can even continue to use your custom domain with your development environment. Just set your edge cache’s TTL to 0. (In fact, that’s what I did to make the update demo for this post.)

Future

We’re really excited about Panda Sky. Both what it does now, and its future.

Mixins

This is the biggie. Mixins allow you to add to Sky’s core API functionality by augmenting the CloudFormation template and deploying other managed AWS micro-services. S3, DynamoDB, Elastic, anyone? Sky is the start of publishing infrastructure that just runs and scales as you need it.

Babel Asset Pipeline

Lambda’s Node runtime only goes up to 6.10, but fear not! Currently, Sky is working proof we can take CoffeeScript v2.0+ and convert into JavaScript running smoothly in our Sky deployment. We will generalize that to all JavaScript and allow you, the developer, to set your own optional Babel configuration for any JavaScript-like setup (Type-Script, or whatever you’d like).

JSON Schemas

JSON schemas allow for both the validation of request bodies and the specification and restriction of what data comes back in the response. They are incredibly powerful, and they will make a welcome addition to the Sky API Format.

API Client Auto-Assembly

We’ve already had some success with building clients that auto-assemble based on API descriptions, so we are excited to apply that experience here. Particularly with our Web Components library, Play.

Auto-Generated Reference Docs

If you can generate a client, you can also generate the reference docs.

Automated Method Dispatching

Right now you need to write your own sky.js file in the root of your handler code, and it’s somewhat tedious. Soon, we hope to release an update to Sky to automatically generate the dispatcher, allowing you to focus on writing your handlers and abstracting all the annoying parts of developing.

More Languages

Our current focus is on Node, but Lambda runtimes support Python, C#, Java, and most recently Go. And, the principles Sky uses are language agnostic. Consider contributing if you see a language you like.

Ace Plushies

Dan promised me that if I built Sky, I’d get to evangelize at conferences by throwing plushie versions of Ace into the crowd (Panda Sky’s mascot, named after a flying ace). That is a future I am willing into existence.

Final Notes

I’ll keep you posted with news from Sky. Here are some more resources to check out in the meantime.