AWS for Games Blog

Ensuring fair play by detecting and preventing profile alterations with Amazon Textract


Developing tools and solutions that can detect and prevent collusion in multiplayer online gaming is crucial for fair play, protecting a game’s integrity, boosting player confidence, and even maintaining a stable in-game economy. One method that gamers use to work together outside the boundaries of legal and ethical standards is sharing phone numbers or other contact information (such as social media accounts) embedded in their profile pictures.

With more and more gamers connecting via online multiplayer experiences, along with the increased monetization of games, it’s imperative to find a scalable solution that game studios can deploy to prevent gamers from working together to gain an unfair advantage over others.

In this blog post, we will walk through how to create an application that leverages Amazon Textract to detect collusion among your player base through the verification of player profile pictures. As players upload their profile pictures, the application quickly identifies and extracts any textual content (such as phone numbers or other identifying information) embedded within the image and then applies a blur effect to hide the contact information.

Solution architecture

This solution acts as a proactive measure that uses advanced technologies to scrutinize profile pictures for textual content, then employs a blurring mechanism to prevent players from contacting one another.

Profile picture validation solution architecture.

Solution overview

  • Users participating in an online game upload their profile pictures within the gaming application.
  • Uploaded profile pictures are securely stored in an Amazon S3 bucket with the PUT event functionality enabled.
  • The S3 PUT event serves as a trigger for an AWS Lambda function, which executes the following steps:
    1. Identifies and extracts text from the profile image using the Amazon Textract
    2. Returns all identified text element coordinates for further processing.
    3. Applies a Gaussian blur filter to every identified text element coordinate for privacy concerns and temporarily stores the blurred image in a processing bucket (to avoid recursive invocation).
    4. Replaces the original image in the primary bucket with the processed blurred image and deletes it from processing bucket.
    5. Sends a notification to the subscribed email address via Amazon Simple Notification Service (Amazon SNS) providing information about the detection of potential collusion in the profile picture.

The repository hosts a reference implementation of the solution discussed in this article. You have the option to deploy, experiment with it, and enhance the solution based on your needs. Subsequent sections will offer insights into the prerequisites for building and running the solution.

Important note: This application leverages multiple AWS services, which means there are associated costs beyond the Free Tier usage. Please refer to the AWS Pricing page for specific details. You are accountable for any incurred AWS costs. This example solution does not imply any warranty.


Deploy the application

  1. Create a new directory, navigate to that directory in a terminal and clone the GitHub repository:

git clone

  1. Change directory to the solution directory:

cd fair-play-guardian

  1. From the command line, use AWS Serverless Application Model (AWS SAM) to build and deploy the AWS resources as specified in the template.yml file.

sam build

sam deploy –guided

During the deploy prompts, follow this guideline:

Stack Name: {Enter your preferred stack name}
AWS Region: {Enter your preferred region}
Parameter PrimaryBucketName: {Enter the bucket name which stores the original profile pictures}
Parameter ProcessingBucketName: {Enter the bucket name which temporarily stores the processed images with text}
Parameter Email: {Enter the email address for notifications pertaining to collusion detection}
Confirm changes before deploy: Y
Allow SAM CLI IAM role creation: Y
Disable rollback: N
Save arguments to configuration file: Y
SAM configuration file: {Press enter to use default name}
SAM configuration environment: {Press enter to use default name}

For an example, see “Configuring SAM deploy” in the image below:

SAM deployment prompts guideline

The following resources will be provisioned:


myFPGS3BucketPrimary AWS::S3::Bucket
myFPGS3BucketProcessing AWS::S3::Bucket
myFPGTopic AWS::SNS::Topic
myFPGSubscription AWS::SNS::Subscription
myFPGvalidateProfilePicture AWS::Lambda::Function
myFPGS3LambdaInvokePermission AWS::Lambda::Permission
myFPGValidateProfilePictureRole AWS::IAM::Role
myFPGValidateProfilePictureS3EventPermission AWS::Lambda::Permission

Confirming the notifications subscription

After the deployment finishes, you receive an Amazon SNS subscription confirmation email at the email address provided during the deployment. Choose the Confirm Subscription link to receive notifications.

The following is a sample email notification for reference.

Sample SNS Subscription Confirmation email

Sample pictures:

  • A few sample pictures are available in the “sample-profile-pictures” directory within this repository.
  • You can use these samples or provide your own image files for testing purposes.

Image upload:

  • Upload the selected image(s) to the S3 Primary bucket, which was specified during deployment.

Lambda function:

  • The Lambda function is triggered by an S3 PUT event when a new profile picture is uploaded to the designated S3 bucket.
  • The processed image with blurred text is stored back in the primary S3 bucket.

Verification steps:

  • Wait for a few seconds for the image with blurred text to be generated in the primary bucket.
  • Download the processed image and verify whether all text elements in the image have been appropriately blurred.

SNS notifications:

  • An SNS topic is configured to send notifications.
  • Notifications are sent to the email address specified during deployment.
  • Verify that you receive an email with the appropriate details regarding the processed image and text blurring.

Note – This solution has been tested with .jpeg, .png and .jpg files. For any other file formats, a minor change may be required in the code to convert the image to a specific format before processing.

Here are few examples of images before and after processing using the solution provided below for your reference.

Table with sample original pictures and corresponding processed images with all text blurred.

Cleaning up

Initially, clear or remove the objects present in both the S3 primary and processing buckets. Ideally, the processing bucket should be empty, but if there are any objects, ensure to delete them.

Then run the command

sam delete


This post explains how to detect and prevent collusion in multiplayer online gaming where users may collude by adding phone numbers to their profile pictures. This solution is crucial for fair play, protecting gaming integrity, boosting player confidence, and maintaining a stable in-game economy. It ensures compliance with legal standards and operates ethically, promoting an overall positive gaming experience.

Learn more about Amazon Textract features

Learn more about Collusion detection in online multiplayer games

Shekhar Shrinivasan

Shekhar Shrinivasan