AWS Services Overview
The Cozy Brew event-driven architecture leverages several fully managed AWS services to achieve high availability, elastic scalability, and loose coupling.
Amazon S3 (Static Website Hosting)
Amazon Simple Storage Service (Amazon S3) is an object storage service offering 99.999999999% (11 9’s) of durability. In this workshop, an S3 bucket is configured for Static Website Hosting:
- Serves the frontend client application (
index.html), modern CSS styling, and responsive JavaScript logic.
- Eliminates the need to provision, patch, or maintain dedicated web servers like Apache or Nginx.
- Enables public, low-latency access to the coffee shop ordering interface.
AWS Lambda (Function URL)
AWS Lambda is an event-driven serverless compute service that runs code without provisioning or managing servers:
- Function URLs: Lambda provides built-in dedicated HTTP(S) endpoints with native CORS support, eliminating the complexity and cost of deploying an Amazon API Gateway for lightweight microservice ingestion.
- Stateless Execution: Each incoming order invocation runs in an isolated container environment that scales automatically with incoming web traffic.
- Event Publisher: Lambda transforms HTTP request payloads into standardized event messages, parses metadata, and publishes them to Amazon SNS.
Amazon SNS (Simple Notification Service)
Amazon SNS is a fully managed Pub/Sub messaging service designed for high-throughput, many-to-many message fan-out:
- Central Event Bus: Acts as the single communication channel (
CoffeeOrders topic) for all order-related events.
- Fan-Out Messaging Pattern: Allows a single published order message to be pushed simultaneously to multiple heterogeneous downstream targets (SQS queues, email addresses, Lambda functions, or HTTP webhooks).
- Asynchronous Decoupling: The order producer (Lambda) does not wait for consumers (baristas or email systems) to finish processing.
Amazon SQS (Simple Queue Service)
Amazon SQS is a fully managed message queuing service that enables asynchronous decoupling of microservices, distributed systems, and serverless applications:
- Buffering & Load Leveling: Acts as a resilient buffer between the fast-moving order publisher and downstream kitchen preparation workers.
- Burst Absorption: During peak hours, order spikes are safely stored in SQS queues without overwhelming cafe staff or crashing backend workers.
- Independent Consumption: Multiple barista workers can poll and process orders concurrently at their own sustainable pace.
Amazon SNS Subscription Filter Policies
Subscription Filter Policies empower subscribers to receive only a targeted subset of messages published to an SNS topic:
- Filtering at the Messaging Fabric: Filtering logic is evaluated directly within Amazon SNS before message delivery, preventing irrelevant messages from ever reaching the subscriber.
- Attribute-Based Routing: Evaluation is based on structured Message Attributes (e.g.,
quantity, drink, size) attached to the event payload.
- Cost & Resource Optimization: Eliminates the need for consumer services to poll, deserialize, and discard unwanted messages, reducing compute costs and network bandwidth.