Amazon Fraud Detector identity-based policy examples - Amazon Fraud Detector

Amazon Fraud Detector identity-based policy examples

By default, IAM users and roles don't have permission to create or modify Amazon Fraud Detector resources. They also can't perform tasks using the AWS Management Console, AWS CLI, or AWS API. An IAM administrator must create IAM policies that grant users and roles permission to perform specific API operations on the specified resources they need. The administrator must then attach those policies to the IAM users or groups that require those permissions.

To learn how to create an IAM identity-based policy using these example JSON policy documents, see Creating Policies on the JSON Tab in the IAM User Guide.

Policy best practices

Identity-based policies are very powerful. They determine whether someone can create, access, or delete Amazon Fraud Detector resources in your account. These actions can incur costs for your AWS account. When you create or edit identity-based policies, follow these guidelines and recommendations:

  • Get started using AWS managed policies – To start using Amazon Fraud Detector quickly, use AWS managed policies to give your employees the permissions they need. These policies are already available in your account and are maintained and updated by AWS. For more information, see Get started using permissions with AWS managed policies in the IAM User Guide.

  • Grant least privilege – When you create custom policies, grant only the permissions required to perform a task. Start with a minimum set of permissions and grant additional permissions as necessary. Doing so is more secure than starting with permissions that are too lenient and then trying to tighten them later. For more information, see Grant least privilege in the IAM User Guide.

  • Enable MFA for sensitive operations – For extra security, require IAM users to use multi-factor authentication (MFA) to access sensitive resources or API operations. For more information, see Using multi-factor authentication (MFA) in AWS in the IAM User Guide.

  • Use policy conditions for extra security – To the extent that it's practical, define the conditions under which your identity-based policies allow access to a resource. For example, you can write conditions to specify a range of allowable IP addresses that a request must come from. You can also write conditions to allow requests only within a specified date or time range, or to require the use of SSL or MFA. For more information, see IAM JSON policy elements: Condition in the IAM User Guide.

AWS-managed (predefined) policy for Amazon Fraud Detector

AWS addresses many common use cases by providing standalone IAM policies that are created and administered by AWS. These AWS managed policies grant necessary permissions for common use cases so that you can avoid having to investigate which permissions are needed. For more information, see AWS Managed Policies in the IAM User Guide.

The following AWS managed policy, which you can attach to users in your account, is specific to Amazon Fraud Detector:

AmazonFraudDetectorFullAccess: Grants full access to Amazon Fraud Detector resources, actions and the supported operations including:

  • List and describe all model endpoints in Amazon SageMaker

  • List all IAM roles in the account

  • List all Amazon S3 buckets

  • Allow IAM Pass Role to pass a role to Amazon Fraud Detector

This policy does not provide unrestricted S3 access. If you need to upload model training datasets to S3, the AmazonS3FullAccess managed policy (or scoped-down custom Amazon S3 access policy) is also required.

You can review the policy’s permissions by signing in to the IAM console and searching by the policy name. You can also create your own custom IAM policies to allow permissions for Amazon Fraud Detector actions and resources as you need them. You can attach these custom policies to the IAM users or groups that require them.

Allow users to view their own permissions

This example shows how you might create a policy that allows IAM users to view the inline and managed policies that are attached to their user identity. This policy includes permissions to complete this action on the console or programmatically using the AWS CLI or AWS API.

{ "Version": "2012-10-17", "Statement": [ { "Sid": "ViewOwnUserInfo", "Effect": "Allow", "Action": [ "iam:GetUserPolicy", "iam:ListGroupsForUser", "iam:ListAttachedUserPolicies", "iam:ListUserPolicies", "iam:GetUser" ], "Resource": ["arn:aws:iam::*:user/${aws:username}"] }, { "Sid": "NavigateInConsole", "Effect": "Allow", "Action": [ "iam:GetGroupPolicy", "iam:GetPolicyVersion", "iam:GetPolicy", "iam:ListAttachedGroupPolicies", "iam:ListGroupPolicies", "iam:ListPolicyVersions", "iam:ListPolicies", "iam:ListUsers" ], "Resource": "*" } ] }

Allowing full access to Amazon Fraud Detector resources

The following example gives an IAM user in your AWS account full access to all Amazon Fraud Detector resources and actions.

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "frauddetector:*" ], "Resource": "*" } ] }

Allowing read-only access to Amazon Fraud Detector resources

In this example, you grant an IAM user in your AWS account read-only access to your Amazon Fraud Detector resources.

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "frauddetector:GetEventTypes", "frauddetector:BatchGetVariable", "frauddetector:DescribeDetector", "frauddetector:GetModelVersion", "frauddetector:GetEventPrediction", "frauddetector:GetExternalModels", "frauddetector:GetLabels", "frauddetector:GetVariables", "frauddetector:GetDetectors", "frauddetector:GetRules", "frauddetector:ListTagsForResource", "frauddetector:GetKMSEncryptionKey", "frauddetector:DescribeModelVersions", "frauddetector:GetDetectorVersion", "frauddetector:GetPrediction", "frauddetector:GetOutcomes", "frauddetector:GetEntityTypes", "frauddetector:GetModels" ], "Resource": "*" } ] }

Allowing access to a specific resource

In this example of a resource-level policy, you grant an IAM user in your AWS account access to all actions and resources except for one particular Detector resource.

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "frauddetector:*" ], "Resource": "*" }, { "Effect": "Deny", "Action": [ "frauddetector:*Detector" ], "Resource": "arn:${Partition}:frauddetector:${Region}:${Account}:detector/${detector-name}" } ] }

Limiting access based on tags

This example policy demonstrates how to limit access to Amazon Fraud Detector based on resource tags. This example assumes that:

  • In your AWS account you have defined two different IAM groups, named Team1 and Team2

  • You have created four detectors

  • You want to allow members of Team1 to make API calls on 2 detectors

  • You want to allow members of Team2 to make API calls on the other 2 detectors

To control access to API calls (example)

  1. Add a tag with the key Project and value A to the detectors used by Team1.

  2. Add a tag with the key Project and value B to the detectors used by Team2.

  3. Create an IAM policy with a ResourceTag condition that denies access to detectors that have tags with key Project and value B, and attach that policy to Team1.

  4. Create an IAM policy with a ResourceTag condition that denies access to detectors that have tags with key Project and value A, and attach that policy to Team2.

The following is an example of a policy that denies specific actions on any Amazon Fraud Detector resource that has a tag with a key of Project and a value of B:

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "frauddetector:*", "Resource": "*" }, { "Effect": "Deny", "Action": [ "frauddetector:CreateModel", "frauddetector:CancelBatchPredictionJob", "frauddetector:CreateBatchPredictionJob", "frauddetector:DeleteBatchPredictionJob", "frauddetector:DeleteDetector" ], "Resource": "*", "Condition": { "StringEquals": { "aws:ResourceTag/Project": "B" } } } ] }