My journey with AWS Serverless

Tips and lesson learned about AWS Lambda and Dynamo DB in last year

background photo source: https://unsplash.com/@withluke
You can scale your Lambda in many different ways, eg: a) start all possible instances, b) scale up 60 additional instances per minute to a maximum of 1,000 concurrent invocations (with SQS), c) set provisioned concurrency to always have min. number of instances running (to prevent cold starts), d) with reserved concurrency (to do not run more than max number of instances).

Async architecture with AWS Lambda

Split your logic

Know the difference between sync and async Lambda

Within AWS Step Functions you can orchestrate event driven application // source: AWS
On failure destination gives a bit more option than dead-letter queue // source: AWS

Think about multiple ways of triggering Lambda

Apart from AWS services you can integrate your lambda with partners event sources (via EventBridge) // source: AWS
Cheatsheet for choosing async event sources for Lambda // source: @theburningmonk

Get some inspirations from others

The Big Fan is a popular pattern based on SNS and SQS (filtering to fan out events to different consumers) // source: cdkpatterns.com

Understand Lambda execution to improve speed

The lifecycle of the execution environment — there could be many invocations within the same runtime, so you might cache some data in global Node.js scope // source: AWS

Use Lambda layers

DynamoDB — performance and throttling

Learn about difference between DynamoDB and relational DB

Think about access patterns

Single table design is a great pattern to deal with Dynamo DB // source: alexdebrie.com

Keep in mind DynamoDB limits

Distribute traffic

Handle errors

Others

Do not forget about monitoring

Creating charts in 3rd party solutions might be easier // source: New Relic Documentation

Do not overcomplicate your stack

Choose the best framework for you

Common practice is to use Terraform to manage shared infrastructure & Serverless or SAM to deploy apps. AWS Amplify is interesting for beginners and for simple or mobile apps. You can also try AWS SDK without touching any framework.

Listen podcasts, read newsletters, prepare for certificate

Full-stack developer - react.js, node.js, serverless. @machnicki

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store