Off-by-none: Issue #23

The State of Serverless…

Welcome to Issue #23 of Off-by-none. It’s so great to have you all here! 🤗

Last week we looked at recent investments into the serverless ecosystem, highlighted some serverless events, and offered some thoughts for picking a database for your next project. This week we’re going to look at how we can use serverless to deal with third-party API quotas, watch some helpful videos, introduce “Serverless Stories”, and so much more.

It’s been another really busy week for serverless, so let’s get right to the good stuff. 🚀

When your third-party API imposes quota limits… 🙅‍♂️

In the serverless world, we often get the impression that our applications can scale without limits. With the right design (and enough money), this is theoretically possible. But in reality, many components of our serverless applications DO have limits. Whether these are physical limits, like network throughput or CPU capacity, or soft limits, like AWS Account Limits or third-party API quotas, our serverless applications still need to be able to handle periods of high load. And more importantly, our end users should experience minimal, if any, negative effects when we reach these thresholds.

One way in which our serverless applications can be limited, is when using third-party APIs that enforce quotas. In my new post, Throttling Third-Party API calls with AWS Lambda, we look at how we can use a combination of SQS, CloudWatch Events, and Lambda functions to implement a precisely controlled throttling system. We also discuss how you can implement (almost) guaranteed ordering, state management (for multi-tiered quotas), and how to plan for failure. Not only is this solution extremely robust and flexible, it’s also very cost effective (like < $2/mth).

When AWS has a slow week… 🐌

I’m sure the AWS teams are all working hard on their next big releases, but in the meantime, they managed to release a few interesting serverless-related updates.

Speaking of state management, AWS Step Functions are an excellent way to add orchestration to your serverless workflows. Now you can Develop and Test AWS Step Functions Workflows Locally, which is a pretty cool feature. Integration testing in the cloud is still necessary, but the more we can do locally, the better.

And for more local testing goodness, Amazon DynamoDB Local Added Support for Transactional APIs, On-Demand Capacity Mode, and 20 GSIs. For many of us that use DynamoDB, these features for the local version are a welcome addition. Uber cool feature: track and return the capacity units consumed by your queries. 👍

Not so serverless, but perhaps “server-less”, is the announcement that AWS Ops Automator v2 now features vertical scaling. Unfortunately, most of us still have to use servers for some of our workloads. But this new vertical scaling feature lets you increase instance sizes instead of simply adding more instances. Scaling up instead of scaling out can be much more cost effective (plus it uses Lambda to do the work 😉).

When you’re looking for innovations in serverless… 👩‍🔬

Epsagon introduced their new Issues Manager that allows you to easily track issues in your serverless applications, identify trends, and quickly jump to Trace Search to troubleshoot them.

IOPipe now enables auto-tracing of HTTP/S calls by default, giving you insight into what external (and internal) API calls are being made and how long they take. You can read all about this new feature at The Secret Life of HTTP(S) Calls in a Serverless World.

Braintree, the payments service, is Introducing Serverless Payment Functions. According to this, “developers will be able to use Braintree to write and deploy serverless functions to instrument their transaction lifecycles, enable 3rd party connections, hook into existing business processes, streamline data exports, and more, all via Braintree tooling.” Not quite sure how this will all work yet, but could be an interesting approach for other SaaS companies to allow for more seamless serverless integrations.

CloudFlare introduced the Workers Cache API, which now lets you modify the REQUEST and RESPONSE objects from within your workers. This is similar to the functionality that Lambda@Edge provides, which is very cool functionality for many use cases.

And Google announced that Cloud Firestore has gone GA. Cloud Firestore is Google’s answer to DynamoDB, but they’ve sprinkled in a handy little feature that lets you export data directly to BigQuery to do additional analysis. Nice way to reduce a data replication step.

What to do if you prefer Prime Video over the Kindle store… 🍿

Good news, the serverless community has been busy producing some really helpful and interesting video content.

Chris Munns and AWS take you on a Deep Dive into AWS SAM and the SAM CLI, plus another Deep Dive Into Lambda Layers and the Lambda Runtime API. Lots of great information packed into these sessions.

James Hood from AWS also shows us how to Accelerate Serverless Development Using AWS SAM & the AWS Serverless Application Repository. This is an excellent intro to Nested Applications, which can be a very handy feature.

Alex Ellis’ talk from GOTO 2018 is now available. Serverless Beyond the Hype is a great talk that starts by giving you an overview of the serverless landscape, and then gets into the nuts and bolts of what makes OpenFaaS different from alternatives such as Knative. If you’re a member of the “serverless on top of containers” crowd, you’ll enjoy this.

The team at Epsagon held a webinar with plenty of insights into Serverless Monitoring in Practice. Interesting look at how complex tracing can be, and what companies like theirs are doing to make it easier.

Our friend Marcia Villabla released two more re:Invent interviews. In the first interview she is Talking about Serverless with Forrest Brazeal, another AWS Serverless Hero and all around serverless expert. She then talks about building AWS communities with Martin Buberl.

I also discovered this site (thanks to Corey Quinn) that organizes a collection of AWS re:Invent videos and podcasts of past and current breakout sessions. Plus they’re searchable, which is really helpful. And if you missed re:Invent last year, you can sign up for the on-demand version of AWS Innovate re:Invent Recap 2018.

Where to look for some interesting serverless use cases… 🕵️‍♀️

I love seeing people apply serverless in new and interesting ways. Below is a handful of nifty little use cases that will hopefully inspire you to do something amazing. 😉

In Lord of the Patch — Story of the PatchBot, Vladyslav Cherednychenko from About You, explains how his team used AWS Lambda to automate vulnerability scans on their EC2 cluster.

Maxime Preaux built a simple Serverless Mailchimp Subscription service using Webtask.io, but you could easily apply this to other providers.

If you’d prefer that your applications do more listening, Apoorva Dave walks us through Building your own Alexa Skill from scratch. I think voice control is only going to become more prevalent, so my advice: start thinking about how your apps can leverage it to create better user experiences.

How to build a Serverless Twitter bot demonstrates another great serverless use case. Lorenzo Tenti builds one using the Serverless Framework, Python and Lambda. Bots are another useful tool when done correctly, and running them on serverless makes a whole ton of sense.

Maybe more of a tool rather than a use case, but Running Jenkins Pipelines in AWS Lambda is possible with a tool called Jenkinsfile-Runner-Lambda. This might be one of those square peg, round hole situations, but Carlos Sanchez points out that “it could make sense to run Jenkinsfiles in Lambda when you are building AWS related stuff.” Maybe, but I think the point is that Lambda is a potential fit for any type of automation.

Finally, Sam Breed (aka Baby Wolfman) created a Lambda WebSocket chess ♟ demo. Could your next MMO be 100% serverless? Might be worth thinking about.

When you’re looking for some encouraging Serverless Stories… 🏆

I’ve been speaking with several people lately about new voices in the serverless community. While I try to recognize people that create helpful content and companies that are innovating in the space, we tend to get stuck in our own echo chamber. This week I’m introducing “Serverless Stories” (or maybe Serverless Voices 🤔), that shares posts from people who are just starting out with serverless or have been adopting serverless in their organizations. I think there is a lot to learn from these folks, especially for those of us trying to foster and build the community. I’d love to know your thoughts on this.

My Serverless Story is a short read that outlines a developer’s foray into the serverless world. It’s interesting to hear their thoughts on the cost of API Gateway, the limited interfaces into managed services (as opposed to traditional methods), and how they believe that it’s not ready for latency-sensitive workloads.

Jordan Finneran wrote a post about Going Serverless where he discusses the migration of an Express.js app. Lack of tooling, reliance on a single provider, cold starts, and of course, event-driven architecture, are his top concerns.

In Lessons learned from launching TubeStats: a completely serverless service, Joshua Khan talks about the execution timeout limits of AWS Lambda functions and how they built their own state management component to overcome it. Interesting takeaway here: he didn’t use Step Functions for orchestration because of “unfamiliarity” and wanting to get “something launched” as soon as possible.

In part 2 of Dirty Old Code, Pierre Bails discusses the process his company used to move their monolithic Ruby on Rails application to a serverless infrastructure. Interesting step-by-step approach which could be a useful template for other companies looking to make the switch.

When you’re looking for some insights into the state of the serverless ecosystem… 📈

John Demian says that Businesses are overcoming challenges with serverless and that “2019 will be the year of serverless.” He points out that cost and speed of development continue to be the motivating factors for companies to push for adoption.

Likewise, TechRadar points out that 2019 will be A year of reckoning for digital transformation. Key takeaway here is the prediction that serverless will be central to a company’s success.

Then there are stories like this: Developers find cautious optimism for serverless platforms. There is a lot of FUD here that purports that tools don’t work as expected and that the developer learning curve is causing problems. 🤦🏻‍♂️

This doesn’t seem to be stopping investment into the space, however, especially since a new report says that Global Serverless Architecture Market Share will Hit USD 18.04 billion by 2024. Serverless is still new, and it has its share of challenges, but the market is growing, and every day implementation gets easier.

The 2019 Microservices Ecosystem by Tobias Kunze is a great read that outlines all the major players and gives some insights into how they all fit in to the larger ecosystem. Serverless is mentioned, of course, but the vast majority are supporting containers and other types of “server-full” approaches.

Why Amazon’s AWS Cloud Business Will Continue to Grow is another interesting piece that gives a bit of insight into AWS’s growth strategy. While they continue to grow their virtual machine business with EC2, they are also supporting container management, and obviously, serverless. More interestingly (which we saw at re:Invent), AWS is saying, “if you don’t want to come to the cloud, we’ll bring the cloud to you.” Support for On-prem, along with the multitude of other offerings, is helping to build up the cloud computing market for all providers.

And speaking of growing the cloud market, a recent piece titled Capital One’s public cloud strategy at odds with industry, points out the benefits of using a public cloud versus a private one. Perhaps most importantly for a bank, the combined security expertise of public cloud providers supplies the trust needed to let Capital One focus on other parts of their stack.

When you’re finally ready to abandon WordPress… 🤬

In case you missed it, generating static sites is all the rage nowadays, and for good reason. I’d venture a guess that 99.9999% of all website traffic are simple GET requests to essentially static pages. Serving those pages up from an edge location cache makes a whole bunch of sense. But whether you’re looking to go fully-static, or leverage new features to reduce your dependencies on servers, there are plenty of options available.

A Greater Gatsby: Modern, Static-Site Generation by Toby Fee answers all your Gatsby-related questions.

If you’re not ready to go fully static, try Going serverless with React and AWS Amplify. Peter Mbanugo walks you through creating a single page app that uses GraphQL to power your dynamic features.

Adam Henson points out that You Might Not Need Server Side Rendering. But what about SEO? Adam does a pretty good job answering why not.

On the other hand, Dan Quackenbush would probably disagree. He talks about how Caching SPAs for SEO with Lamdba@Edge actually increased their crawl rate by 900%.

And let’s not forget that AWS can help you move ALL THE WAY up the stack in some cases. So What AWS service should you use to publish a web site?  Adrian Hall might have the answer for you.

When serverless security shows up on your cloud audit questionnaire… 🔐

Chris Tozzi outlines some Serverless security best practices for cloud dev and ops teams. Pretty standard stuff, but it seems that best practices need to be repeated over and over again.

If you want a really in-depth look at serverless security, you can now watch the Foundations of AWS Lambda Security webinar that Ory Segal and I did, on-demand. Lots of really good stuff in there.

We talked about adding voice control to ours apps a bit earlier, but how do we secure those, especially if they control sensitive internal components?  Aravind Kodandaramaiah from AWS shows us how to Secure and distribute Alexa skills with Alexa for Business. Which, besides the security aspect, could also make for some great internal tooling for your business.

While this story isn’t about serverless, it is a cautionary tale about being a little too paranoid when it comes to security. Digital exchange loses $137 million as founder takes passwords to the grave is an example of failed redundancy. Be smart about your secrets management, even if you think you’re invincible.

When you need the right tool for your serverless job… 🔨

Remember that time you were asking for more serverless frameworks? Well, here you go. Meet TyX, a TypeScript-based serverless backend framework designed for deployment into AWS Lambda.

If you want some more TypeScript, try IFTO: A simple debugging module for AWS Lambda (λ) timeouts.

OPTASY points out the 6 Best Serverless Plugins to tailor the Serverless Framework to your project-specific needs.

If you’re using Lambda@Edge to do redirects, middy-reroute can make your life a lot simpler.

And if you need to debug your serverless applications, Yan Cui shows us how to do it with Dashbird.

StackShare announce their Top 50 Developer Tools of 2018. There were some nice serverless mentions in there including Architect, OpenWhisk, CloudFlare Workers and AWS CloudFront.

What to do if you’re an audiophile, but also love serverless… 🔊

A recent episode of the ThoughtWorks Podcast does some Diving into serverless architecture.  Mike Roberts offers some of his insights.

The Cloudcast: A Serverless Look Ahead for 2019 features special guest, Paul D. Johnston, chatting about the current state of serverless, how to economically think about functions, and areas where serverless needs to improve.

In Diving into Data with Amazon Athena, Simon Elisha shares how Amazon Athena can give you powerful SQL querying capabilities over text files in your S3 buckets. If you’re not familiar with Amazon Athena, you seriously need to check it out.

When you want to get hands-on with serverless tutorials… 👨🏻‍💻

Here is an insanely complete, and step-by-step guide to building a full-stack application using AWS Lambda and React-native.

Binaris also has a Full Stack Tutorial with Serverless & React that includes all the code you need to get up and running in no time.

Yan Cui offers a quick Lambda optimization tip that can speed up HTTP API calls from your serverless applications. TLDR; enable HTTP keep-alive.

For those of you that might be interested in Connecting to AWS DocumentDB from a Lambda function, this post will walk you through it in painstaking detail.

Step Functions can be a bit confusing, but in AWS Step Functions – Doing Serverless is Easier Than You Think, the team at Thundra gives you the all basics.

James Beswick teaches us How to add file upload features to your website with AWS Lambda and S3.

Richard Freeman, PhD, has a great tutorial for Building a Serverless Microservice CRUD RESTful API with MongoDB.

Another thing that can trip you up is Configuration management for serverless AWS applications. Marcin Z-Pa has some thoughts on how to make it easier for you.

If you’re a GitLab CI user, Forrest Brazeal will show you How to set up multi-account AWS SAM deployments.

And finally, if you’re interested in Migrating an Express App into AWS Lambda the Easy Way, this post will give you some practical tips.

Where to go for some interesting serverless reads… 📚

Finding Serverless’ Hidden Costs is an important reminder that pay-per-use can lead to costly mistakes if you aren’t properly monitoring your serverless functions.

In AWS SLA: Are you able to keep your availability promise?, Andreas Wittig show us how to use the new AWS SLAs to calculate our own SLAs. Key point is to make sure you account for other variables besides just AWS’s promises.

Debunking Serverless Tropes by Ryan Marsh has a bit of fun at serverless naysayers’ expense. It made me laugh. 😀

🔥 Multi-region serverless backend — reloaded by Adrian Hornsby is an updated version of his old post on the topic. This time he discusses how the new Global Accelerator service works to eliminate DNS caching for better DR. Highly recommended read for anyone building out a serious, highly-available serverless application.

Raoul Meyer’s AppSync: Basically GraphQL as a service, is a good overview of what AppSync is and provides a few examples to help you get your head around it.

The Top 7 Takeaways from our 2018 Serverless Shows is a look back at Protego’s podcast episodes from last year. They had some great guests with some very good insights.

Nuweba published their Top Serverless Resources You Should Know About. A good list for those interested in staying current with what’s happening in the serverless world.

In Why DevOps Engineers Love AWS Lambda, Ran Ribenzaft from Epsagon gives us a number of great Lambda use cases for automating DevOps processes. These types of practical use cases are a great way for companies to get started with serverless.

Think you can run Kubernetes better than a cloud provider? Think again. Matt Asay argues that building your own Kubernetes cluster is a waste of valuable time. This is based off of a great Twitter thread from Ben Kehoe.

On Infrastructure at Scale: A Cascading Failure of Distributed System by Dan Woods, isn’t really about serverless, but I thought it highlighted some interesting challenges that arise from running distributed systems.

When you want to try something other than AWS… 🤷‍♂️

Ride the Serverless Wave with DigitalOcean’s One-click Droplet shows you how to get OpenFaaS up and running in DigitalOcean with just one click (sort of).

Azure Functions now has moves like Swagger (sorry, bad joke). Introducing Swagger UI on Azure Functions show you how to use a few services to generate your own API docs.

The Mixology Playbook: Kubernetes and Serverless is a well-written piece that talks about the values of a hybrid approach. While I believe there is room for a lot of players at this point, I think serverless (in whatever form it ends up taking) will ultimately win the war.

Hey Google, help me use Cloud Functions is another piece that points out how voice automation could be used to enhance a user experience. Susie Coleman works for the Guardian’s Voice Lab, which is trying to bring the “Guardian’s voice” to Google Assistant. If you’re not thinking about voice automation for your app, you might miss out on a huge opportunity.

Anchal Bhalla teaches you how to Build a Serverless App with Facial Recognition using IBM Cloud Functions. Simple tutorial, but it shows you how powerful some of this stuff is.

And last but not least, Simona Cotin shows us how to use the Azure Resource Manager to write Infrastructure as code for Serverless APIs using just a bit of JSON.

Serverless Star of the Week ⭐️

There is a very long list of people that are doing #ServerlessGood and contributing to the Serverless community. These people deserve recognition for their efforts. So each week, I will mention someone whose recent contribution really stood out to me. I love meeting new people, so if you know someone who deserves recognition, please let me know.

This week’s star is James Beswick (@jbesw). James is a developer, author, AWS-Certified builder, and cofounder of Indevelo, a consulting firm that builds products on AWS. He’s also a speaker, a blogger, and an active member of the serverless community. He recently launched Ask James About AWS, a video series that walks you through a number of common AWS tasks. Through his writings, videos, and talks, James is helping to spread the benefits of serverless, as well as providing useful insights and education to those looking to adopt the cloud. Thanks for what you do, James!

Final Thoughts 🤔

I’ve had a number of really interesting talks with people over the last few weeks about the overall state of serverless. There is a tremendous amount of innovation, lots of great use cases emerging, and new people joining the community every day. However, we have a long way to go before serverless becomes top of mind. We need to continue to encourage collaboration between everyone in this space so that we can educate and spread the word.

Speaking of spreading the word, there are a number of ServerlessDays events coming up that are a great way to support and expand the community. ServerlessDays Boston just announced an amazing speaker lineup, and Hamburg and Austin are right around the corner. I hope you all get a chance to attend one of these events.

I hope you enjoyed this issue of Off-by-none. I love hearing your feedback and suggestions, it helps me make this newsletter better each week. Feel free to contact me via Twitter, LinkedIn, Facebook, or email and let me know your thoughts, criticisms, or how you’d like to contribute to Off-by-none.

Take care,
Jeremy

Throttling Third-Party API calls with AWS Lambda

In the serverless world, we often get the impression that our applications can scale without limits. With the right design (and enough money), this is theoretically possible. But in reality, many components of our serverless applications DO have limits. Whether these are physical limits, like network throughput or CPU capacity, or soft limits, like AWS Account Limits or third-party API quotas, our serverless applications still need to be able to handle periods of high load. And more importantly, our end users should experience minimal, if any, negative effects when we reach these thresholds.

There are many ways to add resiliency to our serverless applications, but this post is going to focus on dealing specifically with quotas in third-party APIs. We’ll look at how we can use a combination of SQS, CloudWatch Events, and Lambda functions to implement a precisely controlled throttling system. We’ll also discuss how you can implement (almost) guaranteed ordering, state management (for multi-tiered quotas), and how to plan for failure. Let’s get started!

Continue Reading…

🚀 Project Update:

Lambda API: v0.8.1 Released

Lambda API v0.8.1 has been released to patch an issue with middleware responses and a path prefixing options bug. The release is immediately available via NPM. Read More...
🚀 Project Update:

Lambda API: v0.6 Released

v0.6 is all about making the serverless developer's life easier! New support for both callback-style and async-await in route functions and middleware, new HTTP method routing features, and route debugging tools. Plus Etag support and automatic authorization parsing. Read More...
🚀 Project Update:

Lambda API: v0.5 Released

v0.5 takes advantage of AWS Lambda's recently released support for Node v8.10 and has removed its Bluebird promise dependency in favor of async/await. Lambda API is now faster and adds built-in CORS support, additional wildcard features, new HTTP header management methods and more. Read More...
🚀 Project Update:

Lambda API: v0.4 Released

v0.4 adds support for a number of standard use cases while still keeping it as lightweight and unopinionated as possible. This new release adds Static & Binary File Support, Route Prefixing, and more. Read More...
🚀 Project Update:

Lambda API: v0.3.0 released

v0.3.0 adds JSONP support, cookie lifecycle management, and some additional updates, inching it closer to becoming a full-featured web framework for serverless applications. ⚡️🤘🏻 Read More...

Securing Serverless: A Newbie’s Guide

So you’ve decided to build a serverless application. That’s awesome! May I be the first to welcome you to the future. 🤖 I bet you’ve done a lot of research. You’ve probably even deployed a few test functions to AWS Lambda or Google Cloud Functions and you’re ready to actually build something useful. You probably still have a bunch of unanswered questions, and that’s cool. We can still build some really great applications even if we only know the basics. However, when we start working with new things we typically make a bunch of dumb mistakes. While some are relatively innocuous, security mistakes can cause some serious damage.

I’ve been working with serverless applications since AWS launched Lambda in early 2015. Over the last few years I’ve developed many serverless applications covering a wide range of use cases. The most important thing I’ve learned: SECURE YOUR FUNCTIONS! I can tell you from personal experience, getting burned by an attack is no bueno. I’d hate to see it happen to you. 😢

To make sure it doesn’t happen to you, I’ve put together a list of 🔒Serverless Security Best Practices. This is not a comprehensive list, but it covers the things you ABSOLUTELY must do. I also give you some more things to think about as you continue on your serverless journey. 🚀

Continue Reading…

How To: Build a Serverless API with Serverless, AWS Lambda and Lambda API

AWS Lambda and AWS API Gateway have made creating serverless APIs extremely easy. Developers can simply create Lambda functions, configure an API Gateway, and start responding to RESTful endpoint calls. While this all seems pretty straightforward on the surface, there are plenty of pitfalls that can make working with these services frustrating.

There are, for example, lots of confusing and conflicting configurations in API Gateway.  Managing deployments and resources can be tricky, especially when publishing to multiple stages (e.g. dev, staging, prod, etc.). Even structuring your application code and dependencies can be difficult to wrap your head around when working with multiple functions.

In this post I’m going to show you how to setup and deploy a serverless API using the Serverless framework and Lambda API, a lightweight web framework for your serverless applications using AWS Lambda and API Gateway. We’ll create some sample routes, handle CORS, and discuss managing authentication. Let’s get started.

Continue Reading…