This Guidance demonstrates how to implement a contextual advertising approach with enhanced machine learning capabilities, designed to reach target audiences without using third-party cookies. Contextual advertising allows advertisers to reach an audience based on the content consumed by users. The approach here utilizes an event-driven, serverless architecture that is highly scalable and cost-optimized. It enables demand-side platforms (DSPs), advertisement publishers, and supply-side platforms (SSPs) to use AWS artificial intelligence and machine learning (AI/ML) services. These services extract relevant metadata from content and map it to their own or industry-standard taxonomy. This metadata informs programmatic bids for publishers, brand safety for advertisers, and advertisement creative classification for supply-side platforms.

Architecture Diagram

[Architecture diagram description]

Download the architecture diagram PDF 

Well-Architected Pillars

The AWS Well-Architected Framework helps you understand the pros and cons of the decisions you make when building systems in the cloud. The six pillars of the Framework allow you to learn architectural best practices for designing and operating reliable, secure, efficient, cost-effective, and sustainable systems. Using the AWS Well-Architected Tool, available at no charge in the AWS Management Console, you can review your workloads against these best practices by answering a set of questions for each pillar.

The architecture diagram above is an example of a Solution created with Well-Architected best practices in mind. To be fully Well-Architected, you should follow as many Well-Architected best practices as possible.

  • All the services used in this Guidance provide Amazon CloudWatch metrics that can be used to monitor individual components of the architecture. API Gateway and Lambda allow for the publishing of new versions through an automated pipeline.

    Read the Operational Excellence whitepaper 
  • API Gateway provides a protection layer when invoking category services through an outbound API. All the proposed services support integration with AWS Identity and Access Management (IAM), which can be used to control access to resources and data.

    Read the Security whitepaper 
  • LambdaDynamoDB, Amazon S3, Amazon Comprehend and Amazon Rekognition provide high availability within a Region. Customers can deploy SageMaker endpoints in a highly available manner.

    Read the Reliability whitepaper 
  • This Guidance requires batch processing for content discovery and content analysis. The performance requirements for batch processing range from minutes to hours, and Lambda, Amazon Comprehend and Amazon Rekognition are designed to meet those requirements. category service requires a latency of less than 10 milliseconds (ms), with the provisioned concurrency in Lambda and the HTTP API in API Gateway supporting a latency requirement of less than 10 ms.

    Read the Performance Efficiency whitepaper 
  • This Guidance uses Lambda to power the compute components of content discovery and content analysis, keeping billing to pay-per-millisecond. The data store is designed using DynamoDB and Amazon S3, providing a low total cost of ownership for storing and retrieving data. For content analysis, this Guidance uses Amazon Comprehend and Amazon Rekognition, allowing customers to pay only when data is processed by the services. The category service uses API Gateway, reducing API development time and helping customers make sure they only pay when an API is invoked.

    Read the Cost Optimization whitepaper 
  • This Guidance uses the scaling behaviors of Lambda and API Gateway to reduce over-provisioning resources. It also uses AWS Managed Services to maximize resource utilization and to reduce the amount of energy needed to run a given workload.

    Read the Sustainability whitepaper 

Implementation Resources

A detailed guide is provided to experiment and use within your AWS account. Each stage of building the Guidance, including deployment, usage, and cleanup, is examined to prepare it for deployment.

The sample code is a starting point. It is industry validated, prescriptive but not definitive, and a peek under the hood to help you begin.

[Content Type]


This [blog post/e-book/Guidance/sample code] demonstrates how [insert short description].


The sample code; software libraries; command line tools; proofs of concept; templates; or other related technology (including any of the foregoing that are provided by our personnel) is provided to you as AWS Content under the AWS Customer Agreement, or the relevant written agreement between you and AWS (whichever applies). You should not use this AWS Content in your production accounts, or on production or other critical data. You are responsible for testing, securing, and optimizing the AWS Content, such as sample code, as appropriate for production grade use based on your specific quality control practices and standards. Deploying AWS Content may incur AWS charges for creating or using AWS chargeable resources, such as running Amazon EC2 instances or using Amazon S3 storage.

References to third-party services or organizations in this Guidance do not imply an endorsement, sponsorship, or affiliation between Amazon or AWS and the third party. Guidance from AWS is a technical starting point, and you can customize your integration with third-party services when you deploy the architecture.

Was this page helpful?