Automated Deployment - Fraud Detection Using Machine Learning

Automated Deployment

Before you launch the automated deployment, please review the considerations discussed in this guide. Follow the step-by-step instructions in this section to configure and deploy Fraud Detection Using Machine Learning into your account.

Time to deploy: Approximately five minutes

What We'll Cover

The procedure for deploying this architecture on AWS consists of the following steps. For detailed instructions, follow the links for each step.

Step 1. Launch the Stack

  • Launch the AWS CloudFormation template into your AWS account.

  • Enter values for the required parameters: Stack Name, Model and Data Bucket Name, Results Bucket Name

  • Review the other template parameters, and adjust if necessary.

Step 2. Run the Notebook

  • Run the Jupyter Notebook to train the ML model.

Step 3. Verify the Lambda Function Is Processing Transactions

  • Verify that the AWS Lambda function is processing transactions.

Step 1. Launch the Stack

This automated AWS CloudFormation template deploys Fraud Detection Using Machine Learning on the AWS Cloud.

Note

You are responsible for the cost of the AWS services used while running this solution. See the Cost section for more details. For full details, see the pricing webpage for each AWS service you will be using in this solution.

  1. Log in to the AWS Management Console and click the button below to launch the fraud-detection-using-machine-learning AWS CloudFormation template.

    
                                Fraud Detection Using Machine Learning launch button

    You can also download the template as a starting point for your own implementation.

  2. The template launches in the US East (N. Virginia) Region by default. To launch this solution in a different AWS Region, use the region selector in the console navigation bar.

    Note

    This solution uses the Amazon SageMaker and Amazon Kinesis Data Firehose services, which are currently available in specific AWS Regions only. Therefore, you must launch this solution in a region where these services are available. For the most current service availability by region, see the AWS service offerings by region.

  3. On the Create stack page, verify the correct template URL shows in the Amazon S3 URL text box and choose Next.

  4. On the Specify stack details page, assign a name to your solution stack.

  5. Under Parameters, review the parameters for the template, and modify them as necessary.This solution uses the following default values.

    Parameter Default Description
    Amazon S3 Bucket Configuration
    Model and Data Bucket Name <Requires input>

    Specify a name for a solution-created Amazon S3 bucket where Amazon SageMaker model and training data will be stored

    Results Bucket Name <Requires input> Specify a name for a solution-created S3 bucket where processed events will be stored
    Amazon Kinesis Firehose Configuration
    Kinesis Firehose S3 Prefix fraud-detection/firehose/ The Kinesis Data Firehose prefix for the delivery of processed events
  6. Choose Next.

  7. On the Options page, choose Next.

  8. On the Review page, review and confirm the settings. Be sure to check the box acknowledging that the template will create AWS Identity and Access Management (IAM) resources.

  9. Choose Create to deploy the stack.

    You can view the status of the stack in the AWS CloudFormation console in the Status column. You should see a status of CREATE_COMPLETE in approximately five minutes.

Important

If you delete the solution stack, you must manually delete the Amazon SageMaker endpoint (fraud_detection_endpoint).

Step 2. Run the Notebook

  1. Navigate to the Amazon SageMaker console.

  2. In the navigation pane, select Notebook instances.

  3. Select FraudDetectionNotebookInstance.

    The notebook instance should already be running.

  4. Select Open Jupyter.

  5. In the Jupyter notebook interface, open the sagemaker_fraud_detection.ipynb file.

  6. In the Cell dropdown menu, select Run All to run the file.

Step 3. Verify the Lambda Function Is Processing Transactions

  1. Navigate to the AWS Lambda console.

  2. In the navigation pane, select Functions.

  3. Select the fraud_detection_event_processor Lambda function.

  4. Select Monitoring and verify that the Invocations graph shows activity. You can also select the View logs in CloudWatch button to view the endpoint activity.

    After a few minutes, check the results Amazon S3 bucket for processed transactions.