Bot Prevention
Menu

Install

Before you install

Check these requirements before you create the stack. Most failed installations come from a missing IAM permission or a conflicting CloudFront function.

Checklist

  • One AWS account. Subscribe in AWS Marketplace with the AWS account that owns the CloudFront distribution. The stack and the KMS key must be in that account.
  • Region us-east-1. The stack, the KMS key and a Web ACL that you supply are in US East (N. Virginia), where CloudFront and global AWS WAF resources live.
  • A CloudFront distribution that meets the CloudFront requirements.
  • IAM permissions to create IAM roles and the stack's resources. See IAM permissions.
  • A World ID Developer Portal account at developer.world.org. You create one app and RP for this website during installation.
  • Your Content Security Policy, if your website sends one, must allow https://*.awswaf.com in script-src and connect-src when the stack inserts the AWS WAF script.
  • World App on a phone, to test a real verification.

CloudFront requirements

The distribution must:

  • be enabled and use pay-as-you-go pricing, not a CloudFront flat-rate plan;
  • have at most 20 hostnames, including its CloudFront domain, and no wildcard aliases;
  • have no viewer-request CloudFront Function and no viewer-request or viewer-response Lambda@Edge function on any cache behavior;
  • use no paths under /__wid/;
  • not be managed by another CloudFormation stack. If CloudFormation, CDK or Terraform manages it, use the setup script.

CloudFront allows one viewer-request function per cache behavior, and no viewer Lambda@Edge function next to it. The session check needs that slot. Viewer-response CloudFront Functions, such as security headers, and origin-event Lambda@Edge functions stay.

Web ACL

You can name an existing global (CloudFront) Web ACL, or let the stack create one. A Web ACL that you name must be attached only to this distribution, and must not contain an AWS WAF Bot Control rule. The stack adds its two rules after your rules and does not change your rules. Requests that your rules block therefore never cost Bot Control inspection, and a request that one of your rules allows is never challenged. If the distribution already uses a Web ACL, name that Web ACL.

IAM permissions

The identity that creates the stack, or the CloudFormation service role that it uses, must be allowed to create IAM roles (iam:CreateRole), manage their inline policies (iam:PutRolePolicy) and pass them to Lambda (iam:PassRole). It also needs permissions for CloudFormation, Lambda, CloudFront Functions and KeyValueStore, DynamoDB, Secrets Manager, S3, CloudWatch Logs and alarms, SNS, and CloudFront and AWS WAF changes. Updates and uninstallation need the same permissions.

This policy allows everything that installing, updating and uninstalling the stack needs, and nothing else. It names each action that CloudFormation uses for the stack's resource types. Resources are not scoped, because the stack names them only when it creates them; scope them to your stack's names if your account requires it:

Deployment policy

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "Stack",
      "Effect": "Allow",
      "Action": [
        "cloudformation:CancelUpdateStack",
        "cloudformation:ContinueUpdateRollback",
        "cloudformation:CreateChangeSet",
        "cloudformation:CreateStack",
        "cloudformation:DeleteChangeSet",
        "cloudformation:DeleteStack",
        "cloudformation:DescribeChangeSet",
        "cloudformation:DescribeStackEvents",
        "cloudformation:DescribeStackResource",
        "cloudformation:DescribeStackResources",
        "cloudformation:DescribeStacks",
        "cloudformation:ExecuteChangeSet",
        "cloudformation:GetTemplate",
        "cloudformation:GetTemplateSummary",
        "cloudformation:ListChangeSets",
        "cloudformation:ListStackResources",
        "cloudformation:ListStacks",
        "cloudformation:RollbackStack",
        "cloudformation:TagResource",
        "cloudformation:UntagResource",
        "cloudformation:UpdateStack",
        "cloudformation:ValidateTemplate"
      ],
      "Resource": "*"
    },
    {
      "Sid": "ExecutionRoles",
      "Effect": "Allow",
      "Action": [
        "iam:CreateRole",
        "iam:DeleteRole",
        "iam:DeleteRolePermissionsBoundary",
        "iam:DeleteRolePolicy",
        "iam:GetRole",
        "iam:GetRolePolicy",
        "iam:ListAttachedRolePolicies",
        "iam:ListRolePolicies",
        "iam:ListRoleTags",
        "iam:PutRolePermissionsBoundary",
        "iam:PutRolePolicy",
        "iam:TagRole",
        "iam:UntagRole",
        "iam:UpdateAssumeRolePolicy",
        "iam:UpdateRole",
        "iam:UpdateRoleDescription"
      ],
      "Resource": "*"
    },
    {
      "Sid": "PassRolesToLambda",
      "Effect": "Allow",
      "Action": "iam:PassRole",
      "Resource": "*",
      "Condition": {
        "StringEquals": {
          "iam:PassedToService": "lambda.amazonaws.com"
        }
      }
    },
    {
      "Sid": "Resources",
      "Effect": "Allow",
      "Action": [
        "cloudfront:CreateCachePolicy",
        "cloudfront:CreateFunction",
        "cloudfront:CreateKeyValueStore",
        "cloudfront:CreateOriginAccessControl",
        "cloudfront:CreateOriginRequestPolicy",
        "cloudfront:DeleteCachePolicy",
        "cloudfront:DeleteFunction",
        "cloudfront:DeleteKeyValueStore",
        "cloudfront:DeleteOriginAccessControl",
        "cloudfront:DeleteOriginRequestPolicy",
        "cloudfront:DescribeFunction",
        "cloudfront:DescribeKeyValueStore",
        "cloudfront:GetCachePolicy",
        "cloudfront:GetFunction",
        "cloudfront:GetOriginAccessControl",
        "cloudfront:GetOriginRequestPolicy",
        "cloudfront:ListTagsForResource",
        "cloudfront:PublishFunction",
        "cloudfront:TagResource",
        "cloudfront:UntagResource",
        "cloudfront:UpdateCachePolicy",
        "cloudfront:UpdateFunction",
        "cloudfront:UpdateKeyValueStore",
        "cloudfront:UpdateOriginAccessControl",
        "cloudfront:UpdateOriginRequestPolicy",
        "cloudwatch:DeleteAlarms",
        "cloudwatch:DescribeAlarms",
        "cloudwatch:ListTagsForResource",
        "cloudwatch:PutMetricAlarm",
        "cloudwatch:TagResource",
        "cloudwatch:UntagResource",
        "dynamodb:CreateTable",
        "dynamodb:DeleteResourcePolicy",
        "dynamodb:DeleteTable",
        "dynamodb:DescribeContinuousBackups",
        "dynamodb:DescribeContributorInsights",
        "dynamodb:DescribeTable",
        "dynamodb:DescribeTimeToLive",
        "dynamodb:GetResourcePolicy",
        "dynamodb:ListTagsOfResource",
        "dynamodb:PutResourcePolicy",
        "dynamodb:TagResource",
        "dynamodb:UntagResource",
        "dynamodb:UpdateContinuousBackups",
        "dynamodb:UpdateContributorInsights",
        "dynamodb:UpdateTable",
        "dynamodb:UpdateTimeToLive",
        "lambda:AddPermission",
        "lambda:CreateFunction",
        "lambda:CreateFunctionUrlConfig",
        "lambda:DeleteFunction",
        "lambda:DeleteFunctionConcurrency",
        "lambda:DeleteFunctionUrlConfig",
        "lambda:GetFunction",
        "lambda:GetFunctionCodeSigningConfig",
        "lambda:GetFunctionRecursionConfig",
        "lambda:GetFunctionUrlConfig",
        "lambda:GetPolicy",
        "lambda:GetRuntimeManagementConfig",
        "lambda:InvokeFunction",
        "lambda:PublishVersion",
        "lambda:PutFunctionConcurrency",
        "lambda:PutFunctionRecursionConfig",
        "lambda:PutRuntimeManagementConfig",
        "lambda:RemovePermission",
        "lambda:TagResource",
        "lambda:UntagResource",
        "lambda:UpdateFunctionCode",
        "lambda:UpdateFunctionConfiguration",
        "lambda:UpdateFunctionUrlConfig",
        "logs:CreateLogGroup",
        "logs:DeleteDataProtectionPolicy",
        "logs:DeleteIndexPolicy",
        "logs:DeleteLogGroup",
        "logs:DeleteMetricFilter",
        "logs:DeleteResourcePolicy",
        "logs:DeleteRetentionPolicy",
        "logs:DescribeIndexPolicies",
        "logs:DescribeLogGroups",
        "logs:DescribeLogStreams",
        "logs:DescribeMetricFilters",
        "logs:DescribeResourcePolicies",
        "logs:GetDataProtectionPolicy",
        "logs:ListTagsForResource",
        "logs:PutDataProtectionPolicy",
        "logs:PutIndexPolicy",
        "logs:PutLogGroupDeletionProtection",
        "logs:PutMetricFilter",
        "logs:PutResourcePolicy",
        "logs:PutRetentionPolicy",
        "logs:TagResource",
        "logs:UntagResource",
        "s3:CreateBucket",
        "s3:DeleteBucket*",
        "s3:Get*Configuration",
        "s3:GetBucket*",
        "s3:GetObject",
        "s3:GetObjectVersion",
        "s3:ListBucket",
        "s3:ListTagsForResource",
        "s3:Put*Configuration",
        "s3:PutBucket*",
        "s3:TagResource",
        "s3:UntagResource",
        "secretsmanager:CreateSecret",
        "secretsmanager:DeleteSecret",
        "secretsmanager:DescribeSecret",
        "secretsmanager:GetRandomPassword",
        "secretsmanager:GetSecretValue",
        "secretsmanager:TagResource",
        "secretsmanager:UntagResource",
        "secretsmanager:UpdateSecret",
        "sns:CreateTopic",
        "sns:DeleteTopic",
        "sns:GetDataProtectionPolicy",
        "sns:GetSubscriptionAttributes",
        "sns:GetTopicAttributes",
        "sns:ListSubscriptionsByTopic",
        "sns:ListTagsForResource",
        "sns:PutDataProtectionPolicy",
        "sns:SetSubscriptionAttributes",
        "sns:SetTopicAttributes",
        "sns:Subscribe",
        "sns:TagResource",
        "sns:Unsubscribe",
        "sns:UntagResource",
        "wafv2:CreateRegexPatternSet",
        "wafv2:CreateRuleGroup",
        "wafv2:CreateWebACL",
        "wafv2:DeleteRegexPatternSet",
        "wafv2:DeleteRuleGroup",
        "wafv2:DeleteWebACL",
        "wafv2:GetRegexPatternSet",
        "wafv2:GetRuleGroup",
        "wafv2:GetWebACL",
        "wafv2:ListTagsForResource",
        "wafv2:TagResource",
        "wafv2:UntagResource",
        "wafv2:UpdateRegexPatternSet",
        "wafv2:UpdateRuleGroup",
        "wafv2:UpdateWebACL"
      ],
      "Resource": "*"
    }
  ]
}

The stack creates three execution roles. Each trusts only the Lambda service:

RoleLets the function
ApiRoleSign with your KMS key, read the cookie keys, write replay state and write logs.
SetupRoleCreate the cookie keys, copy the challenge assets, read distribution hostnames, fill the CloudFront key store and write logs.
InstallerRoleAttach and detach World ID on your distribution and Web ACL, run installation checks and write logs.

These roles do not give World access to your account. Their policies allow exactly these statements, and CloudFormation shows them before you create the stack. Resources-only installations have no InstallerRole.

ApiRoleResource
dynamodb:PutItem, dynamodb:UpdateItemThe stack's replay-state table
secretsmanager:GetSecretValueThe stack's cookie secret
kms:Sign, kms:GetPublicKeyYour RP signing key (RpSigningKeyArn)
logs:CreateLogStream, logs:PutLogEventsThe API function's log group
SetupRoleResource
secretsmanager:GetSecretValue, secretsmanager:PutSecretValueThe stack's cookie secret
cloudfront:GetDistributionYour distribution (DistributionId)
cloudformation:DescribeStackResource, cloudformation:DescribeStacksThis stack
s3:ListBucketVersionsThe stack's asset bucket, prefix __wid/assets/
s3:DeleteObjectVersionObjects under __wid/assets/ in the stack's asset bucket
s3:ListBucketWorld's release bucket, prefix of this release
s3:GetObjectThis release's objects in World's release bucket
s3:PutObjectThis release's assets under __wid/assets/ in the stack's asset bucket
cloudfront-keyvaluestore:DescribeKeyValueStore, cloudfront-keyvaluestore:PutKeyThe stack's CloudFront KeyValueStore
logs:CreateLogStream, logs:PutLogEventsThe setup function's log group
InstallerRoleResource
cloudfront:GetDistribution, cloudfront:UpdateDistributionYour distribution (DistributionId)
cloudfront:ListDistributionsByWebACLId* (this API takes no resource)
wafv2:GetWebACLThe Web ACL: yours (WebAclArn) or the one the stack creates
wafv2:CheckCapacity* (this API takes no resource)
wafv2:GetRuleGroup, wafv2:UpdateRuleGroupThe stack's rule group and path pattern set
wafv2:UpdateWebACLThe Web ACL, the stack's rule group, and the rule groups, managed rule sets and pattern sets that the Web ACL references
cloudformation:DescribeStackResource, cloudformation:DescribeStacksThis stack
cloudformation:DescribeStackResources* (to refuse a distribution or Web ACL that another stack owns)
logs:CreateLogStream, logs:PutLogEventsThe installer function's log group

If you do not have these permissions

  • Ask an AWS administrator to create the stack, or
  • ask an administrator for a CloudFormation service role with these permissions, and select it in Configure stack options, Permissions.

If your account requires a permissions boundary on new roles, enter its policy ARN in the PermissionsBoundaryArn stack parameter. The stack sets it on all three roles. Precreated execution roles are not supported.

AWS costs

The stack runs in your AWS account, so AWS bills its resources to you, in addition to the per-verification price on the AWS Marketplace listing. These are us-east-1 list prices from November 2026; check them with the AWS Pricing Calculator.

ResourceFixed per monthPer use
AWS WAF Bot Control (targeted)$10$10 per million inspected page and API requests after the first million. Static files and /__wid/ routes are not inspected.
AWS WAF$8 for the rules ($5 more for the Web ACL when the stack creates one)$0.60 per million requests, when the stack creates the Web ACL. An existing Web ACL already bills them.
CloudFront FunctionsNone$0.10 per million requests after the account's free 2 million
AWS KMS, Secrets Manager, CloudWatch$1 for the signing key, $0.40 for the cookie key secret, $0.20 for two alarmsOne KMS signature per verification ($0.15 per 10,000)
Lambda, DynamoDB, S3, CloudWatch LogsNoneAbout $0.02 per 1,000 verifications, plus log storage

Estimates for a stack that creates its Web ACL, assuming half of the requests are pages and API calls:

WebsiteRequests per monthVerificationsAWS cost per month
Small2 million1,000about $26
Medium20 million20,000about $129
Large200 million200,000about $1,160

Bot Control inspection is the largest item at higher traffic. With an existing Web ACL, subtract $5 and the WAF request charges. The World ID price is separate: verifications per month times the price per verification on the listing, billed through AWS Marketplace. CloudFront charges for your traffic do not change.

Test on a staging site first

If you can, install on a staging distribution first. Each Marketplace subscription covers one distribution, so a staging site needs its own subscription and World ID RP. On a production site, you can start in monitor-only mode and test with one always-verified path.