TalksAWS re:Invent 2025 - From Zero to Millions: Building Real-Time Applications at Scale (API312)

AWS re:Invent 2025 - From Zero to Millions: Building Real-Time Applications at Scale (API312)

Building Real-Time Applications at Scale with AWS AppSync Events

Challenges of Building Real-Time Applications

  • Building real-time applications involves complex challenges:
    • Monitoring application logic, databases, caching, etc.
    • Handling real-time data updates and events
    • Scaling to support millions of users
  • Traditional approaches like polling can be inefficient at scale
  • Bidirectional communication using WebSockets is more scalable, but introduces additional complexity:
    • Tracking connected users
    • Implementing fan-out to broadcast updates to many users
    • Scaling the backend infrastructure

Leveraging AWS AppSync Events

  • AWS AppSync Events is a fully managed pub/sub service for building real-time APIs
  • Reduces operational overhead of managing WebSockets at scale
  • Provides built-in features for authorization, business logic, and scalability

Key AppSync Events Concepts

  • Namespaces: Top-level organization for different types of events
  • Channel Segments: Dynamically created segments within a namespace
  • Publishers: Clients or backend systems that publish events
  • Subscribers: Clients or backend systems that subscribe to events

Handling Player Entry at Scale

  • Used API Gateway to implement rate limiting and control connection requests
    • First 2,000 requests per second allowed, remainder throttled with 429 responses
    • Clients handle retries with exponential backoff
  • Leveraged API Gateway caching and direct DynamoDB integration to optimize read-heavy operations
  • Persisted player join information using AppSync Events business logic in event handlers

Sending and Receiving Real-Time Updates

  • Publishers (e.g. Lambda functions) send updates to namespaces/channels
  • Subscribers (e.g. client applications) receive updates over persistent WebSocket connections
  • Implemented authorization using IAM roles and API keys to control access

Calculating and Distributing Scores

  • Asynchronous Lambda function handles score calculation and updates
    • Validates answers, updates scores in DynamoDB
    • Publishes score updates to individual user channels
  • Used DynamoDB Streams and a Lambda function to efficiently publish leaderboard updates

Monitoring and Observability

  • Monitored key metrics in AWS:
    • AppSync Events connection request rate and active connections
    • Lambda function invocations and concurrent executions
    • DynamoDB read/write capacity usage
  • Leveraged AWS Lambda Power Tools for improved logging and metrics

Key Takeaways

  • AppSync Events simplifies building real-time, bidirectional communication at scale
  • Careful architectural design is crucial to handle connection management, fan-out, and scalability
  • Leveraging managed services like API Gateway, DynamoDB, and Lambda can optimize performance and reduce operational overhead
  • Monitoring and observability are essential for identifying bottlenecks and ensuring reliable operation

Real-World Applications

  • Real-time applications are prevalent in many industries:
    • Ride-sharing apps tracking vehicle locations
    • Sports scores and betting odds updates
    • Multiplayer online games
    • Collaborative applications like document editing

The AWS AppSync Events service provides a powerful, managed solution for building these types of real-time, scalable applications, reducing the complexity of WebSocket management and enabling efficient, reliable real-time data distribution.

Your Digital Journey deserves a great story.

Build one with us.

Cookies Icon

These cookies are used to collect information about how you interact with this website and allow us to remember you. We use this information to improve and customize your browsing experience, as well as for analytics.

If you decline, your information won’t be tracked when you visit this website. A single cookie will be used in your browser to remember your preference.