Skip to content
GitHubXDiscord

Variable

The Variable resource lets you manage AWS FraudDetector Variables which are crucial for defining and using customizable data inputs for fraud detection models.

Create a basic FraudDetector variable with required properties and a common optional property.

import AWS from "alchemy/aws/control";
const fraudVariable = await AWS.FraudDetector.Variable("userAgeVariable", {
name: "userAge",
dataType: "NUMERIC",
defaultValue: "0",
description: "Represents the age of the user",
dataSource: "USER_DEFINED"
});

Configure a variable with additional properties, including tags and variable type.

const advancedVariable = await AWS.FraudDetector.Variable("transactionAmountVariable", {
name: "transactionAmount",
dataType: "NUMERIC",
defaultValue: "0",
description: "The amount of the transaction made by the user",
dataSource: "USER_DEFINED",
variableType: "EVENT",
tags: [
{ key: "Environment", value: "Production" },
{ key: "Application", value: "PaymentGateway" }
]
});

If you want to adopt an existing resource instead of failing if it already exists, you can set the adopt property to true.

const adoptedVariable = await AWS.FraudDetector.Variable("existingTransactionVariable", {
name: "existingTransaction",
dataType: "NUMERIC",
defaultValue: "100",
dataSource: "USER_DEFINED",
adopt: true
});

Create a detailed variable specifically for tracking user behavior in a fraud detection scenario.

const userBehaviorVariable = await AWS.FraudDetector.Variable("userBehaviorVariable", {
name: "userBehaviorScore",
dataType: "NUMERIC",
defaultValue: "0",
description: "A score representing the user's behavior for fraud detection",
dataSource: "USER_DEFINED",
variableType: "EVENT",
tags: [
{ key: "UserType", value: "Premium" },
{ key: "RiskLevel", value: "High" }
]
});