Skip to main content

w3-lambdas

Purpose

AWS Lambda and CloudFront edge functions used by the W3 system.

Architecture

  • Serverless Framework configs are grouped by function family.
  • Shared dependencies are packaged as a Lambda layer (w3-common-lib).
  • Most functions load config from AWS SSM Parameter Store at runtime.

Functions

Cognito signup handler

  • Location: w3-sign-up-hanlder-lambda
  • Trigger: Cognito signup event (expected)
  • Behavior: pushes a USER_SIGNUP message to SQS (SQS_SIGN_UP_HANDLER_QUEUE).

Learn vocab handlers

  • Location: w3-lambda-learn-vocab
  • retrieve-words-handler: reads from DynamoDB table DYNAMODB_LEARN_VOCAB_WORDS_TABLE (action getWords).
  • modify-words-handler: inserts or removes words in the same table (actions insertWords and removeWord).

Homepage geo block (Lambda@Edge)

  • Location: w3-homepage-geo-block-edge-lambda
  • Behavior: blocks requests by country using cloudfront-viewer-country.

CloudFront functions

  • w3-homepage-geo-block-cf-function: blocks non-VN countries at the viewer request.
  • w3-homepage-redirect-cognito-login-cf-function: redirects /login to Cognito Hosted UI.

Lambda layer

  • Location: w3-layers/commonLib
  • Layer name: w3-common-lib