The Serverless Framework makes it easy to use AWS Lambda and other managed cloud services to build applications that auto-scale, cost nothing when idle, and result in radically low maintenance. Basically, for a really high-level TLDR: serverless bridges the gap between your existing architecture patterns and ones that work well with Lambda.

General Architecture Pointers

Functions

Each function is an independent unit of execution and deployment, like a microservice. A function is merely code, deployed in the cloud, that is most often written to perform a single job such as:

  • Saving a user to the database
  • Processing a file in a database
  • Performing a scheduled task

Events

Functions are triggered by events. Events come from other AWS resources, for example:

  • An https request on an API Gateway URL (e.g. for a REST API)
  • A new file uploaded in an S3 bucket (e.g. for an image upload)
  • A CloudWatch schedule (e.g. run every 5 minutes)
  • A message in an SNS topic
  • A CloudWatch alert

When you configure an event on a Lambda function, Serverless Framework will automatically create the infrastructure needed for that event (e.g. an API Gateway endpoint) and configure your functions to listen to it.

Services

A service is the Framework’s unit of organization. You can think of it as a project file, though you can have multiple services for a single application.

A service is configured via a serverless.yml file where you define your functions, events and AWS resources to deploy. It looks like this:

service: users
 
functions: # Your "Functions"
  usersCreate:
    events: # The "Events" that trigger this function
      - httpApi: 'POST /users/create'
  usersDelete:
    events:
      - httpApi: 'DELETE /users/delete'
 
resources: # The "Resources" your "Functions" use. Raw AWS CloudFormation goes in here.
 

Suggested Readings

Linked Map of Contexts