Getting started with Serverless: 3 Easy Patterns

Friday, July 10, 2020 • edited Sunday, November 22, 2020

If you’re a dev who is new to working with serverless technologies, this is for you!

At AWS Serverless Community Day ANZ a couple of weeks ago, I presented this talk which steps through 3 common patterns and how they’re implemented.

I’m relatively new to working with serverless architecture myself, and initially found the configuration of AWS services and piecing them together a bit overwhelming. So I thought I’d share some tips alongside how to demo these patterns in 3 services.

The patterns we look at are:

  • Simple Web Service
  • Data Processing Pipeline
  • Fan-Out

Each of which contain a demo project. The mini projects are pretty simple, but aim to break down some concepts you’ll find in larger scale projects.

💡 You can view the demo code here: https://github.com/natasjja/3-serverless-patterns

I recommend forking the repo, looking into the code, deploying and follow what’s happening in the AWS console!

Click on the image below to view the talk on YouTube:

Serverless Patterns

Q&A

There was a short Q&A at the end that went like this:

Q: What are some of the typical mistakes or ‘gotchas’ that you’ve experienced using Serverless?

A: Indentation and lurking spaces in the serverless.yml file has been one - I’ve definitely been caught out by that a few times! Policies have caught me out too, so keep an eye on what permissons you’re granting to different resources. Accessing the right data in handlers too - which is why I like to use console logs to test and debug better.

Q: Is there any specific reason you chose the Serverless framework over something like AWS SAM or AWS CDK framework?

A: Starting out myself, I think the Serverless framework is really great for beginners. If you have no previous experience with AWS or serverless architecture, it’s a great place to start. The reasons for that being are that the documentation is awesome, it’s well written and understandable for learners. There’s a tone of blogs on their website and free courses as well. The synxtax is a lot easier to write and it’s easier to deploy, compared to AWS SAM - it’s literally sls deploy and you can pass a stage variable to it. Also, there’s a huge amount of community contributions. There’s tones of plugins that you can use to make your life easier too.

Q: How do we avoid turning our serverless applications into massive monoliths, with 100 API gateway endpoints and handlers?

A: Another good thing about the Serverless framework is that you can break down resources into external yaml files and reference them in the serverless.yml file. So the serverless file itself doesn’t need to be huge - it just references those external resources.

If you have any other questions, feel free to reach out to me on LinkedIn!

serverlessnodejsawslambda

Streaming Video at Scale: A Tale of Transcoding at A Cloud Guru

Tips for remote teaching