Skip to content

aws-solutions-library-samples/guidance-for-building-an-event-driven-sportsbook-on-aws

Guidance for Building an Event-Driven Sportsbook on AWS

Table of Contents

  1. Overview
  2. Prerequisites
  3. Deployment Steps
  4. Deployment Validation
  5. Running the Guidance
  6. Next Steps
  7. Cleanup
  8. Notices

Overview

This application demonstrates how to build an event-driven, serverless sportsbook application on AWS to help betting and gambling operators effectively handle spiky and seasonal traffic. Using microservices and serverless computing, the application shows operators how to overcome the scaling limitations of traditional sportsbook applications. Each microservice has its own documentation that provides more details about its purpose, architecture, and implementation.

NOTE: This guidance demonstrates an architectural pattern. The application is not production ready in its current state.

Select a link from the following list to learn more about the microservice.

High Level Architecture

High Level Architecture Diagram

Cost

You are responsible for the cost of the AWS services used while running this Guidance. As of August 2025, the cost for running this Guidance with the default settings in AWS Region US EAST 1 (N. Virginia) is approximately $16.70 per month for processing 1200 bets daily. This value will not scale linearly because of volume based pricing used by some AWS services used for the sportsbook application.

Sample Cost Table

The following table provides a sample cost breakdown for deploying this Guidance with the default parameters in the US East (N. Virginia) Region for one month assuming non-production traffic volumes.

AWS service Dimensions Cost [USD]
AWS AppSync 950,000 API requests per month $ 3.80
Amazon Cognito 50 active user per month without advanced security feature $ 2.50
Amazon SQS 4,130,000 standard queue requests per month $ 1.65
Amazon DynamoDB 5 GB storage, 2,525,000 write requests, 2,533,000 read requests per month $ 4.57
AWS Lambda 4,500,000 requests per month with 200 ms average duration, 256 MB memory, 512 ephemeral storage $ 0.70
AWS Step Functions 72000 workflow requests per month with 1 state transitions per workflow $ 1.70
Amazon EventBridge 3,570,000 invocations, 1,785,000 events ingested, 1,785,000 events delivered per month $ 1.78

Prerequisites

Operating System

These deployment instructions are optimized to best work on a Linux based system. Deployment to other operating systems may require additional steps.

The following tools are required to install the sample application.

  • AWS CLI >= 2.15
  • AWS SAM CLI >= 1.136

Third-party tools

  • NodeJS >= 22.18
  • Python >= 3.12

Deployment Steps

  1. Clone the repo using command.

    git clone https://github.com/aws-solutions-library-samples/guidance-for-building-an-event-driven-sportsbook-on-aws.git event-driven-sportsbook
  2. Change directory to the repository folder.

    cd event-driven-sportsbook
  3. Initialise a Python virtual environment.

    python3 -m venv .venv
  4. Activate the virtual environment.

    source .venv/bin/activate
  5. Install the required Python libraries to the virtual environment.

    python3 -m pip install -r requirements.txt
  6. Build and deploy the microservices.

    sam build
    sam deploy --guided --capabilities CAPABILITY_AUTO_EXPAND CAPABILITY_IAM
  7. Provide a value for the Stack Name and AWS Region when you are prompted by the guided deployment process.

    • Stack Name
      • Description: The name of the Cloudformation application stack.
      • Example: sportsbook
    • AWS Region
      • Description: The AWS region where the application will be deployed.
      • Example: eu-west-2
  8. Accept the default values for the following parameters.

    • EventBusName
    • AccessLogsBucket
    • CognitoAdvancedSecurity
    • GeoRestrictiontype
    • GeoRestrictionLocation
    • DomainName
    • CertificateArn
  9. Install the web application npm dependencies.

    npm install
    
  10. Update the web application configuration, then build and deploy the web application.

    npm run config
    npm run build
    npm run deploy

    [!TIP] In order, these commands:

    1. Generates a .env.local file with stack outputs from the infrastructure build
    2. Builds the frontend application
    3. Copies the application build to the s3 bucket that CloudFront points at

Deployment Validation

  • Using the AWS Management Console, open CloudFormation and verify that the sportsbook CloudFormation stack was successfully deployed.
  • Get the web application URL - WebUrl from the CloudFormation stack outputs.

Running the Guidance

  • Go to the web application using a web browser.
  • Register an account using a valid email address.

Next Steps

Complete the Event-driven Sportsbook workshop to understand how the application works.

Cleanup

  1. Log into the AWS Management Console then empty the sportsbook WebUIBucket Amazon S3 bucket.

  2. Delete the sportsbook CloudFormation stack by executing the following command from the project root directory.

    sam delete --config-file samconfig.toml

Notices

Customers are responsible for making their own independent assessment of the information in this Guidance. This Guidance: (a) is for informational purposes only, (b) represents AWS current product offerings and practices, which are subject to change without notice, and (c) does not create any commitments or assurances from AWS and its affiliates, suppliers or licensors. AWS products or services are provided “as is” without warranties, representations, or conditions of any kind, whether express or implied. AWS responsibilities and liabilities to its customers are controlled by AWS agreements, and this Guidance is not part of, nor does it modify, any agreement between AWS and its customers.

Authors

About

This Guidance demonstrates how to build an event-driven, serverless sportsbook application to help sports betting operators handle spiky, seasonal traffic.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published