Skip to content

Serverless web API on AWS

CloudFront (a global service, so drawn outside the Region) serves a single-page app from S3 and sends /api/* to an API Gateway REST API, Lambda and DynamoDB, with a Cognito user pool authorizer; the function also writes to a receipts bucket.

aws8 nodes2 groups8 edges
Edit in the playgroundOpen full size
Serverless web API on AWS with CloudFront, S3, API Gateway, Lambda, DynamoDB and CognitoServerless web API on AWS with CloudFront, S3, API Gateway, Lambda, DynamoDB and CognitoServerless web API on AWS with CloudFront, S3, API Gateway, Lambda, DynamoDB and CognitoServerless web API on AWS with CloudFront, S3, API Gateway, Lambda, DynamoDB and Cognito
aws-serverless-api.yamlOn GitHub
# yaml-language-server: $schema=../references/diagram.schema.json
title: Serverless web API on AWS
subtitle: Single-page app on CloudFront, REST API on API Gateway and Lambda, Cognito sign-in
direction: right
layout: { spacing: 0.9 }

legend:
  solid: Request path
  dashed: Sign-in
  dotted: Authorizer check

groups:
  cloud: { type: aws:cloud }
  region: { type: aws:region, label: us-east-1, in: cloud }

nodes:
  users: { icon: aws:users, label: Users }
  # CloudFront is a global service: it sits in the AWS Cloud group, outside the Region.
  cdn: { icon: aws:cloudfront, label: Amazon CloudFront, in: cloud }
  site: { icon: aws:simple-storage-service-bucket, label: Web app bucket, note: Static SPA assets, in: region }
  # align keeps Cognito under API Gateway, the service that calls it.
  auth: { icon: aws:cognito, label: Amazon Cognito, note: User pool, in: region, align: api }
  api: { icon: aws:api-gateway, label: Amazon API Gateway, note: REST API, in: region }
  fn: { icon: aws:lambda-lambda-function, label: Orders function, note: AWS Lambda, in: region }
  table: { icon: aws:dynamodb-table, label: Orders table, note: Amazon DynamoDB, in: region }
  uploads: { icon: aws:simple-storage-service-bucket, label: Receipts bucket, in: region }

edges:
  - users -> cdn: HTTPS
  - users --> auth: sign in
  - cdn -> site: static files
  - cdn -> api: /api/*
  - api ..> auth: Cognito authorizer
  - api -> fn
  - fn -> table, uploads

Start from this one

Copies the spec to diagram.yaml, then renders every format.

$ orrery init aws-serverless-api$ orrery render diagram.yaml -f all --theme both