# yaml-language-server: $schema=../references/diagram.schema.json
title: Video on demand and live streaming on AWS
subtitle: A VOD lane and a live lane built on AWS Elemental Media Services converge on Amazon CloudFront, with a serverless playback API beside them
direction: right
layout: { spacing: 0.7 }

groups:
  cloud: { type: aws:cloud }
  region: { type: aws:region, label: us-east-1, in: cloud }
  vod: { type: zone, label: Video on demand, in: region }
  live: { type: zone, label: Live, in: region }
  playback: { type: zone, label: Playback API, in: region }

nodes:
  studio: { icon: aws:user, label: Content team, note: Uploads mezzanine files }
  camera: { icon: aws:camera, label: Live camera, note: Contribution feed }
  source: { icon: aws:s3-bucket, label: Source bucket, note: Amazon S3, in: vod }
  convert: { icon: aws:elemental-mediaconvert, label: AWS Elemental MediaConvert, note: Transcode to ABR, in: vod }
  packaged: { icon: aws:s3-bucket, label: Output bucket, note: HLS and DASH, in: vod }
  encode: { icon: aws:elemental-medialive, label: AWS Elemental MediaLive, note: Live encoding, in: live }
  origin: { icon: aws:elemental-mediapackage, label: AWS Elemental MediaPackage, note: JIT packaging, in: live }
  ads: { icon: aws:elemental-mediatailor, label: AWS Elemental MediaTailor, note: Ad insertion, in: live }
  # Players call the playback API before they stream; that hop is left to the notes.
  api: { icon: aws:api-gateway, label: Amazon API Gateway, note: Playback sessions, in: playback }
  entitle: { icon: aws:lambda, label: AWS Lambda, note: Entitlements, in: playback }
  sessions: { icon: aws:dynamodb, label: Amazon DynamoDB, note: Sessions, in: playback }
  # CloudFront is a global service: it sits in the AWS Cloud group, outside the Region.
  cdn: { icon: aws:cloudfront, label: Amazon CloudFront, note: Edge delivery, in: cloud }
  viewers: { icon: aws:mobile-client, label: Viewers, note: Web and mobile }

edges:
  # The two lanes and the playback API read left to right, one above the other; the notes say
  # what each service does, so only the hop into CloudFront carries a label.
  - studio -> source
  - source -> convert -> packaged
  - camera -> encode
  - encode -> origin -> ads
  - packaged, ads -> cdn: origin
  - cdn -> viewers
  - api -> entitle -> sessions
