Giter Site home page Giter Site logo

aws-samples / amazon-fraud-detector-with-cognito Goto Github PK

View Code? Open in Web Editor NEW
8.0 6.0 3.0 162 KB

A CDK Application containing Stacks that deploy necessary resources required to implement a real-time fraud detection and prevention system using Amazon Fraud Detector and Amazon Cognito.

License: MIT No Attribution

Shell 0.49% JavaScript 99.51%

amazon-fraud-detector-with-cognito's Introduction

Fraud Prevention with Amazon Fraud Detector and Amazon Cognito

This application demostrates how to implement Amazon Fraud Detector along with Amazon Cognito User Pools with customized auth flows and utilizing Cognito Lambda triggers to implement friction in the registration process for users whose fraud risk score is medium.

For fraud risk scores low, users will be registered and confirmed automatically to the Cognito User Pool. For fraud risk score high the PreSignUp Lambda trigger will prevent the user from sign up.

This project contains AWS Cloud Development Kit (CDK) application that deploys all the AWS resources necessary to implement a real-time fraud detection system using Amazon Cognito's custom auth workflow.

architecture

Getting Started

Pre-requisites

Installation

  1. Clone this repository and change directory
git clone <repo_url> afd-cognito-demo
cd afd-cognito-demo
  1. Install the required CDK Modules
npm install --save
  1. Update the .env file with the necessary information. You will need to provide the AWS account number and region you wish to deploy this application to. You will also need information about Amazon Fraud Detector' detector name, version, event type name and entity type names that you created as part of the pre-requisites. For example
AWS_ACCOUNT_NUMBER=111122223333
AWS_REGION=us-east-1
AFD_DETECTOR_NAME=sample_detector
AFD_DETECTOR_VERSION=1
AFD_EVENT_TYPE=sample_registration
AFD_ENTITY_TYPE=sample_customer
  1. Confiure IAM policies in the config/policies.json file. This CDK project creates Lambda functions. In order for the Lambda functions to be able to access other AWS resources, such as Amazon Fraud Detector, Cognito User Pool, and DynamoDB table, it needs an IAM Role with the required permissions. You should add policy names in the policies.json file so that the CDK project can create the IAM Role with the policies.
{
    "policy_names":[
        "policy-name-1",
        "policy-name-2",
        "policy-name-2"
    ]
}

For the purposes of this project the following AWS Managed policies are sufficient.

service-role/AWSLambdaVPCAccessExecutionRole
AmazonCognitoPowerUser
AmazonDynamoDBFullAccess
AmazonFraudDetectorFullAccessPolicy

โš ๏ธ Some of the policies specified above can be more permissive than desired. Please exercise caution and follow principles of least privileges while creating IAM Roles for your AWS resources.

  1. Bootstrap the CDK project by replacing the <account_number> and <region> with your AWS account number and region where you wish to deploy the project.
cdk bootstrap aws://<account_number>/<region>
  1. Synthesize an AWS Cloudfromation template from the CDK project
cdk synth --all
  1. Deploy the CDK Project
cdk deploy --all
  1. (Optional) If you have already deployed this CDK app but have made new changes, you can run the command below to see the changes
cdk diff

Cleaning up

To avoid incurring future charges, delete the resources created for the solution.

cdk destroy --all

Security

See CONTRIBUTING for more information.

License

This library is licensed under the MIT-0 License. See the LICENSE file.

amazon-fraud-detector-with-cognito's People

Contributors

anjanvb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

mpividal wasa-ism

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.