Empower Your Business: Safeguard Against Online Frauds with Amazon Fraud Detection Service

Quick Tutorial to demonstrate the use of Amazon Fraud Detection to detect frauds during registration


5 min read


In today's digital landscape, the proliferation of online transactions has brought immense convenience but also heightened risks of fraud. Recognizing the critical need for businesses to protect themselves and their customers, Amazon introduced the Fraud Detection Service (AFD). This innovative solution leverages advanced machine learning algorithms and real-time monitoring to detect and prevent fraudulent activities swiftly and effectively.

In this article, you will learn how you can use the Amazon Fraud Detection service to detect fraudulent entries during registration. We will be using the example dataset provided by Amazon to train our model. You can find the training dataset from this link.

Creating an event

First, let's start by creating an event. Open your AWS console and search for Amazon Fraud Detection service. Once on the page, click on the "Create event" button.

This will open the "Create Event Type" form. An event type defines the structure for an event sent to the service. In the Event Type Details section, enter a name and a description of the event. Next, we need to create an entity for the event. An entity represents who is performing the event. In the Entity creation form, enter the entity type name and description and create the entity. Select the newly created entity in the main form.

In the next section of the form, we need to provide the Training Data. But first, we need to select how do we want to define the event variables. In our case, we want to select the variables from the Training Dataset. The very important thing to note that for this demo, we are going to upload the training dataset file to a S3 storage bucket, which needs to be created in the same region of the Fraud Detection Service. In this form, we are going to create an IAM role which will give the service, the permission to access the S3 bucket. Then we are going to specify the location of the file. Before doing this, please create an S3 bucket and upload the dataset into it.

Once you paste the proper location of the dataset file, you will see the Variables and Variable Type table. In this table, you need to map each variable to an known variable type.

Next, in the Labels Section, please mention at least 2 labels: Fraud and Legit.

Finally, you can submit the form.

Specifying Model Details

Once the event is created, lets move to the Model section, where we are going to select the suitable model for our use-case and train it with the training dataset.

Click on the "Add your first model" button. In the "Define Model Details", mention the model name and select the "Online Fraud Insights" model type. Finally select the event you had previously created in this form.

This will open the "Historical event data" section. Here, you need to select the event source as data stored in S3. For the IAM role, mention the same bucket name if you want to keep the model output files in the same bucket. Then, again mention the location of the training dataset and click Next.

In the next page, you need to select a specific label for Fraud and Legitimate.

Clicking "Next" will take you to the review page. Finally you can click the "Create and Train Model" button to start the training process.

Now, we need to wait for sometime to complete the model training process. Once completed, you can see the model performance metrics.

Finally, you can deploy the model version.

Create the Detector

Detectors are comprised of Models and rules that evaluates the event for fraud.

Click on the "Create Detector" button to open the form. Fill in the name, description and the event type for the detector and Click "Next".

In the following page, you need to add the Model you created in the earlier section.

After that, you need to add the rules for the detector. We are going to make 3 rule: fraud_rule, legit_rule & review_rule.

In the "Add Rules" page, mention the name and description of the respective rules. Then, you need to add the Expression using the Service's Expression language. The expression generally consists of some event variables or model output scores. In this scenario, we will be using the model output score.

For the fraud_rule, the output score should be greater than 900. The outcome should be risk_high.

For the legit_rule, the output score should be less than 700. The outcome should be risk_low.

For the review_rule, the output score should be greater than 700 but less than 900. The outcome should be risk_medium.

Finally you will see 3 rules listed in the page.

In the next step, you need to configure the order of the rule execution. For the Execution mode, select the "First Matched" option and continue.

Finally review the information and submit the form to create the detector.

This completes all the steps that are required to setup the Fraud Detection service for our application.

Testing the Model

To test the model, you can take some data from the dataset and paste it in the fields of the "Run Tests" section. Once entered, you can see the prediction at the bottom.


As businesses navigate the complex and ever-evolving landscape of online transactions, the importance of robust fraud detection and prevention measures cannot be overstated. Amazon's Fraud Detection Service emerges as a powerful ally in this endeavor, offering advanced technology and real-time insights to safeguard against fraudulent activities. By leveraging AFD, businesses can not only protect themselves and their customers but also enhance their overall operational efficiency and reputation. As we conclude our exploration of AFD, it's clear that investing in such cutting-edge solutions is not just a proactive stepβ€”it's a fundamental necessity in today's digital economy.

Did you find this article valuable?

Support Avik Kundu by becoming a sponsor. Any amount is appreciated!