ARC-305-R Serverless Architectural Patterns and Best Practices

Overview

  • Recommended!
  • Good summary of sls patterns and with diagrams easy to understand.
  • Well explained

Slides

Youtube

Memo

lambda lifecycle

Lifecycle start
download + start new container + bootstrap the runtime cold start
start code warm start

Lambda Power tuning

See! https://github.com/alexcasalboni/aws-lambda-power-tuning

Best practices

  • Minimize package size
  • Use env variables
  • Java: use dagger2, jackson-jr
  • Make sure functions invoked by Amazon SQA don’t exceed the Visibility timeout

Recommendation: use SAM

  • CloudFromation for serverless
  • resources: functions, APIs, table
  • local testing

AWS Code services: AWS CodeStar -> CodeCommit + CodeBuild + ….

Lambda alias: Autopublish alias (see blog)

First pattern: microservices/API

API GW

type 1: Edge optimized API gateway managed

CloudFront + Lambda@edge tip: see AWS blueprints

region

disaster recovery scenarios see 2 photos

private

consumers inside vpc

security

see photo

notes: use resource policies

Cognito - Identity providers: exchange a token for a IAM policy

graphQL

Query language for APIs

AWS AppSync

see photo

Pattern 2: Stream processing

types: video streams, data streams, data firehose, data analytics

data stream

recommendation for near realtime processing:

  • source -> data stream -> aws lambda -> other AWS services
  • key: buffer size

fan-out pattern

  • trades strict message ordering vs high throughput

real-time analytics

see 2 photos

pattern 3: data lake

characteristics: see photo

  • ingest (kinesis, data FireHorse, iot, )
  • core is S3
  • catalog & search (dynamo, glue, ES)
  • analytics & processing (lambda, Athena, Quicksight, glue, RedShift spectrum)
  • security & auditing (IAM, kms, cloudtrail, Macie)
  • API (API GW)

note: Macie can help to identify PII data in a data lake

see 2 photos (core + foundation)

search and data catalog

DynamoDB as metadata repository

!see photos!!!! a lot of them

scale lambda: Pywrenh.io

pattern 4: machine learning

see photo (machine learning stack)

Example: Amazon Connect. serverless contact center solution

see photo (intelligent CC chatbot)

All photos

Original Description

As serverless architectures become more popular, customers need a framework of patterns to help them identify how to leverage AWS to deploy their workloads without managing servers or operating systems. This session describes reusable serverless patterns while considering costs. For each pattern, we provide operational and security best practices and discuss potential pitfalls and nuances. We also discuss the considerations for moving an existing server-based workload to a serverless architecture. This session can help you recognize candidates for serverless architectures in your own organizations and understand areas of potential savings and increased agility.