Introducing a new console experience for Amazon WAF
You can now use the updated experience to access Amazon WAF functionality anywhere in the console. For more details, see Working with the updated console experience.
How Amazon WAF works with IAM
This section explains how to use the features of IAM with Amazon WAF.
Before you use IAM to manage access to Amazon WAF, learn what IAM features are available to use with Amazon WAF.
| IAM feature | Amazon WAF support |
|---|---|
|
Yes |
|
|
Yes |
|
|
Yes |
|
|
Yes |
|
|
Yes |
|
|
No |
|
|
Partial |
|
|
Yes |
|
|
Yes |
|
|
Yes |
|
|
Yes |
To get a high-level view of how Amazon WAF and other Amazon services work with most IAM features, see Amazon services that work with IAM in the IAM User Guide.
Identity-based policies for Amazon WAF
Supports identity-based policies: Yes
Identity-based policies are JSON permissions policy documents that you can attach to an identity, such as an IAM user, group of users, or role. These policies control what actions users and roles can perform, on which resources, and under what conditions. To learn how to create an identity-based policy, see Define custom IAM permissions with customer managed policies in the IAM User Guide.
With IAM identity-based policies, you can specify allowed or denied actions and resources as well as the conditions under which actions are allowed or denied. To learn about all of the elements that you can use in a JSON policy, see IAM JSON policy elements reference in the IAM User Guide.
To view examples of Amazon WAF identity-based policies, see Identity-based policy examples for Amazon WAF.
Resource-based policies within Amazon WAF
Supports resource-based policies: Yes
Resource-based policies are JSON policy documents that you attach to a resource. Examples of resource-based policies are IAM role trust policies and Amazon S3 bucket policies. In services that support resource-based policies, service administrators can use them to control access to a specific resource. For the resource where the policy is attached, the policy defines what actions a specified principal can perform on that resource and under what conditions. You must specify a principal in a resource-based policy. Principals can include accounts, users, roles, federated users, or Amazon Web Services services.
To enable cross-account access, you can specify an entire account or IAM entities in another account as the principal in a resource-based policy. For more information, see Cross account resource access in IAM in the IAM User Guide.
Amazon WAF uses resource based policies to support the sharing of rule groups across
accounts. You share a rule group that you own with another Amazon account by
providing the resource-based policy settings to the Amazon WAF API call
PutPermissionPolicy or to an equivalent CLI or SDK call. For
additional information, including examples and links to documentation for the other
available languages, see PutPermissionPolicy in the Amazon WAF API Reference. This functionality isn't
available through other means, such as the console or Amazon CloudFormation.
Policy actions for Amazon WAF
Supports policy actions: Yes
Administrators can use Amazon JSON policies to specify who has access to what. That is, which principal can perform actions on what resources, and under what conditions.
The Action element of a JSON policy describes the
actions that you can use to allow or deny access in a policy. Include actions in a policy to grant permissions to perform the associated operation.
To see a list of Amazon WAF actions and permissions for each, see Actions defined by Amazon WAF V2 in the Service Authorization Reference.
Policy actions in Amazon WAF use the following prefix before the action:
wafv2
To specify multiple actions in a single statement, separate them with commas.
"Action": [ "wafv2:action1", "wafv2:action2" ]
You can specify multiple actions using wildcards (*). For example, to specify all
actions in Amazon WAF that begin with List, include the following
action:
"Action": "wafv2:List*"
To view examples of Amazon WAF identity-based policies, see Identity-based policy examples for Amazon WAF.
Actions that require additional permissions settings
Some actions require permissions that can't be completely described in Actions defined by Amazon WAF V2 in the Service Authorization Reference. This section provides additional permissions information.
Topics
Permissions for
AssociateWebACL
This section lists the permissions required to associate a protection pack (web ACL) to a resource using the
Amazon WAF action AssociateWebACL.
For Amazon CloudFront distributions, instead of this action, use the
CloudFront action UpdateDistribution. For information, see UpdateDistribution in the Amazon CloudFront API Reference.
Amazon API Gateway REST API
Requires permission to call API Gateway SetWebACL on the REST API
resource type and to call Amazon WAF AssociateWebACL on a protection pack (web ACL).
{ "Sid": "AssociateWebACL1", "Effect": "Allow", "Action": [ "wafv2:AssociateWebACL" ], "Resource": [ "arn:aws:wafv2:region:account-id:regional/webacl/*/*" ] }, { "Sid": "AssociateWebACL2", "Effect": "Allow", "Action": [ "apigateway:SetWebACL" ], "Resource": [ "arn:aws:apigateway:*::/restapis/*/stages/*" ] }
Application Load Balancer
Requires permission to call elasticloadbalancing:SetWebACL action
on the Application Load Balancer resource type and to call Amazon WAF
AssociateWebACL on a protection pack (web ACL).
{ "Sid": "AssociateWebACL1", "Effect": "Allow", "Action": [ "wafv2:AssociateWebACL" ], "Resource": [ "arn:aws:wafv2:region:account-id:regional/webacl/*/*" ] }, { "Sid": "AssociateWebACL2", "Effect": "Allow", "Action": [ "elasticloadbalancing:SetWebACL" ], "Resource": [ "arn:aws:elasticloadbalancing:*:account-id:loadbalancer/app/*/*" ] }
Amazon AppSync GraphQL API
Requires permission to call Amazon AppSync SetWebACL on the GraphQL API
resource type and to call Amazon WAF AssociateWebACL on a protection pack (web ACL).
{ "Sid": "AssociateWebACL1", "Effect": "Allow", "Action": [ "wafv2:AssociateWebACL" ], "Resource": [ "arn:aws:wafv2:region:account-id:regional/webacl/*/*" ] }, { "Sid": "AssociateWebACL2", "Effect": "Allow", "Action": [ "appsync:SetWebACL" ], "Resource": [ "arn:aws:appsync:*:account-id:apis/*" ] }
Amazon Cognito user pool
Requires permission to call the Amazon Cognito AssociateWebACL action on
the user pool resource type and to call Amazon WAF AssociateWebACL on a
protection pack (web ACL).
{ "Sid": "AssociateWebACL1", "Effect": "Allow", "Action": [ "wafv2:AssociateWebACL" ], "Resource": [ "arn:aws:wafv2:region:account-id:regional/webacl/*/*" ] }, { "Sid": "AssociateWebACL2", "Effect": "Allow", "Action": [ "cognito-idp:AssociateWebACL" ], "Resource": [ "arn:aws:cognito-idp:*:account-id:userpool/*" ] }
Amazon App Runner service
Requires permission to call the App Runner AssociateWebACL action on the
App Runner service resource type and to call Amazon WAF AssociateWebACL on a web
ACL.
{ "Sid": "AssociateWebACL1", "Effect": "Allow", "Action": [ "wafv2:AssociateWebACL" ], "Resource": [ "arn:aws:wafv2:region:account-id:regional/webacl/*/*" ] }, { "Sid": "AssociateWebACL2", "Effect": "Allow", "Action": [ "apprunner:AssociateWebAcl" ], "Resource": [ "arn:aws:apprunner:*:account-id:service/*/*" ] }
Amazon Verified Access instance
Requires permission to call the
ec2:AssociateVerifiedAccessInstanceWebAcl action on the Verified Access
instance resource type and to call Amazon WAF AssociateWebACL on a web
ACL.
{ "Sid": "AssociateWebACL1", "Effect": "Allow", "Action": [ "wafv2:AssociateWebACL" ], "Resource": [ "arn:aws:wafv2:region:account-id:regional/webacl/*/*" ] }, { "Sid": "AssociateWebACL2", "Effect": "Allow", "Action": [ "ec2:AssociateVerifiedAccessInstanceWebAcl" ], "Resource": [ "arn:aws:ec2:*:account-id:verified-access-instance/*" ] }
Permissions for
DisassociateWebACL
This section lists the permissions required to disassociate a protection pack (web ACL) from a resource using the
Amazon WAF action DisassociateWebACL.
For Amazon CloudFront distributions, instead of this action, use the
CloudFront action UpdateDistribution with an empty protection pack (web ACL) ID. For information, see UpdateDistribution in the Amazon CloudFront API Reference.
Amazon API Gateway REST API
Requires permission to call API Gateway SetWebACL on the REST API
resource type. Does not require permission to call Amazon WAF DisassociateWebACL.
{ "Sid": "DisassociateWebACL", "Effect": "Allow", "Action": [ "apigateway:SetWebACL" ], "Resource": [ "arn:aws:apigateway:*::/restapis/*/stages/*" ] }
Application Load Balancer
Requires permission to call the elasticloadbalancing:SetWebACL
action on the Application Load Balancer resource type. Does not require permission to call Amazon WAF DisassociateWebACL.
{ "Sid": "DisassociateWebACL", "Effect": "Allow", "Action": [ "elasticloadbalancing:SetWebACL" ], "Resource": [ "arn:aws:elasticloadbalancing:*:account-id:loadbalancer/app/*/*" ] }
Amazon AppSync GraphQL API
Requires permission to call Amazon AppSync SetWebACL on the GraphQL API
resource type. Does not require permission to call Amazon WAF DisassociateWebACL.
{ "Sid": "DisassociateWebACL", "Effect": "Allow", "Action": [ "appsync:SetWebACL" ], "Resource": [ "arn:aws:appsync:*:account-id:apis/*" ] }
Amazon Cognito user pool
Requires permission to call the Amazon Cognito DisassociateWebACL action on
the user pool resource type and to call Amazon WAF DisassociateWebACL.
{ "Sid": "DisassociateWebACL1", "Effect": "Allow", "Action": "wafv2:DisassociateWebACL", "Resource": "*" }, { "Sid": "DisassociateWebACL2", "Effect": "Allow", "Action": [ "cognito-idp:DisassociateWebACL" ], "Resource": [ "arn:aws:cognito-idp:*:account-id:userpool/*" ] }
Amazon App Runner service
Requires permission to call the App Runner DisassociateWebACL action on
the App Runner service resource type and to call Amazon WAF DisassociateWebACL.
{ "Sid": "DisassociateWebACL1", "Effect": "Allow", "Action": "wafv2:DisassociateWebACL", "Resource": "*" }, { "Sid": "DisassociateWebACL2", "Effect": "Allow", "Action": [ "apprunner:DisassociateWebAcl" ], "Resource": [ "arn:aws:apprunner:*:account-id:service/*/*" ] }
Amazon Verified Access instance
Requires permission to call the
ec2:DisassociateVerifiedAccessInstanceWebAcl action on the Verified Access
instance resource type and to call Amazon WAF DisassociateWebACL.
{ "Sid": "DisassociateWebACL1", "Effect": "Allow", "Action": "wafv2:DisassociateWebACL", "Resource": "*" }, { "Sid": "DisassociateWebACL2", "Effect": "Allow", "Action": [ "ec2:DisassociateVerifiedAccessInstanceWebAcl" ], "Resource": [ "arn:aws:ec2:*:account-id:verified-access-instance/*" ] }
Permissions for
GetWebACLForResource
This section lists the permissions required to get the protection pack (web ACL) for a protected resource using the
Amazon WAF action GetWebACLForResource.
For Amazon CloudFront distributions, instead of this action, use the
CloudFront action GetDistributionConfig.
For information, see GetDistributionConfig in the Amazon CloudFront API Reference.
Note
GetWebACLForResource requires the permission to call
GetWebACL. In this
context, Amazon WAF uses GetWebACL only to verify that your account has the permission it needs to access the
protection pack (web ACL) that GetWebACLForResource returns. When you call
GetWebACLForResource, you might get an error
indicating that your account is not authorized to perform
wafv2:GetWebACL on the resource. Amazon WAF doesn't add this
type of error to the Amazon CloudTrail event history.
Amazon API Gateway REST API, Application Load Balancer, and Amazon AppSync GraphQL API
Require permission to call Amazon WAF GetWebACLForResource and
GetWebACL for a protection pack (web ACL).
{ "Sid": "GetWebACLForResource", "Effect": "Allow", "Action": [ "wafv2:GetWebACLForResource", "wafv2:GetWebACL" ], "Resource": [ "arn:aws:wafv2:region:account-id:regional/webacl/*/*" ] }
Amazon Cognito user pool
Requires permission to call the Amazon Cognito GetWebACLForResource action
on the user pool resource type and to call Amazon WAF GetWebACLForResource
and GetWebACL.
{ "Sid": "GetWebACLForResource1", "Effect": "Allow", "Action": [ "wafv2:GetWebACLForResource", "wafv2:GetWebACL" ], "Resource": [ "arn:aws:wafv2:region:account-id:regional/webacl/*/*" ] }, { "Sid": "GetWebACLForResource2", "Effect": "Allow", "Action": [ "cognito-idp:GetWebACLForResource" ], "Resource": [ "arn:aws:cognito-idp:*:account-id:userpool/*" ] }
Amazon App Runner service
Requires permission to call the App Runner DescribeWebAclForService
action on the App Runner service resource type and to call Amazon WAF
GetWebACLForResource and GetWebACL.
{ "Sid": "GetWebACLForResource1", "Effect": "Allow", "Action": [ "wafv2:GetWebACLForResource", "wafv2:GetWebACL" ], "Resource": [ "arn:aws:wafv2:region:account-id:regional/webacl/*/*" ] }, { "Sid": "GetWebACLForResource2", "Effect": "Allow", "Action": [ "apprunner:DescribeWebAclForService" ], "Resource": [ "arn:aws:apprunner:*:account-id:service/*/*" ] }
Amazon Verified Access instance
Requires permission to call the
ec2:GetVerifiedAccessInstanceWebAcl action on the Verified Access instance
resource type and to call Amazon WAF GetWebACLForResource and
GetWebACL.
{ "Sid": "GetWebACLForResource1", "Effect": "Allow", "Action": [ "wafv2:GetWebACLForResource", "wafv2:GetWebACL" ], "Resource": [ "arn:aws:wafv2:region:account-id:regional/webacl/*/*" ] }, { "Sid": "GetWebACLForResource2", "Effect": "Allow", "Action": [ "ec2:GetVerifiedAccessInstanceWebAcl" ], "Resource": [ "arn:aws:ec2:*:account-id:verified-access-instance/*" ] }
Permissions for
ListResourcesForWebACL
This section lists the permissions required to retrieve the list of protected resources for a protection pack (web ACL) using the
Amazon WAF action ListResourcesForWebACL.
For Amazon CloudFront distributions, instead of this action, use the
CloudFront action ListDistributionsByWebACLId. For
information, see ListDistributionsByWebACLId in the Amazon CloudFront API
Reference.
Amazon API Gateway REST API, Application Load Balancer, and Amazon AppSync GraphQL API
Require permission to call Amazon WAF ListResourcesForWebACL for a web
ACL.
{ "Sid": "ListResourcesForWebACL", "Effect": "Allow", "Action": [ "wafv2:ListResourcesForWebACL" ], "Resource": [ "arn:aws:wafv2:region:account-id:regional/webacl/*/*" ] }
Amazon Cognito user pool
Requires permission to call the Amazon Cognito ListResourcesForWebACL
action on the user pool resource type and to call Amazon WAF
ListResourcesForWebACL.
{ "Sid": "ListResourcesForWebACL1", "Effect": "Allow", "Action": [ "wafv2:ListResourcesForWebACL" ], "Resource": [ "arn:aws:wafv2:region:account-id:regional/webacl/*/*" ] }, { "Sid": "ListResourcesForWebACL2", "Effect": "Allow", "Action": [ "cognito-idp:ListResourcesForWebACL" ], "Resource": [ "arn:aws:cognito-idp:*:account-id:userpool/*" ] }
Amazon App Runner service
Requires permission to call the App Runner
ListAssociatedServicesForWebAcl action on the App Runner service
resource type and to call Amazon WAF ListResourcesForWebACL.
{ "Sid": "ListResourcesForWebACL1", "Effect": "Allow", "Action": [ "wafv2:ListResourcesForWebACL" ], "Resource": [ "arn:aws:wafv2:region:account-id:regional/webacl/*/*" ] }, { "Sid": "ListResourcesForWebACL2", "Effect": "Allow", "Action": [ "apprunner:ListAssociatedServicesForWebAcl" ], "Resource": [ "arn:aws:apprunner:*:account-id:service/*/*" ] }
Amazon Verified Access instance
Requires permission to call the
ec2:DescribeVerifiedAccessInstanceWebAclAssociations action on the
Verified Access instance resource type and to call Amazon WAF
ListResourcesForWebACL.
{ "Sid": "ListResourcesForWebACL1", "Effect": "Allow", "Action": [ "wafv2:ListResourcesForWebACL" ], "Resource": [ "arn:aws:wafv2:region:account-id:regional/webacl/*/*" ] }, { "Sid": "ListResourcesForWebACL2", "Effect": "Allow", "Action": [ "ec2:DescribeVerifiedAccessInstanceWebAclAssociations" ], "Resource": [ "arn:aws:ec2:*:account-id:verified-access-instance/*" ] }
Policy resources for Amazon WAF
Supports policy resources: Yes
Administrators can use Amazon JSON policies to specify who has access to what. That is, which principal can perform actions on what resources, and under what conditions.
The Resource JSON policy element specifies the object or objects to which the action applies. As a best practice, specify a resource using its Amazon Resource Name (ARN). For actions that don't support resource-level permissions, use a wildcard (*) to indicate that the statement applies to all resources.
"Resource": "*"
To see the list of Amazon WAF resource types and their ARNs, see
Resources defined by Amazon WAF V2 in the Service Authorization Reference. To learn with
which actions you can specify the ARN of each resource, see Actions defined by Amazon WAF V2. To
allow or deny access to a subset of Amazon WAF resources, include the ARN of the
resource in the resource element of your policy.
The ARNs of Amazon WAF wafv2 resources have the following format:
arn:partition:wafv2:region:account-id:scope/resource-type/resource-name/resource-id
For general information about ARN specifications, see Amazon Resource Names (ARNs) in the Amazon Web Services General Reference.
The following lists requirements that are specific to the ARNs of wafv2
resources:
-
region: For Amazon WAF resources that you use to protect Amazon CloudFront distributions, set this tous-east-1. Otherwise, set this to the Region you're using with your protected regional resources. -
scope: Set the scope toglobalfor use with an Amazon CloudFront distribution orregionalfor use with any of the regional resources that Amazon WAF supports. The regional resources are an Amazon API Gateway REST API, an Application Load Balancer, an Amazon AppSync GraphQL API, an Amazon Cognito user pool, an Amazon App Runner service, and an Amazon Verified Access instance. -
resource-type: Specify one of the following values:webacl,rulegroup,ipset,regexpatternset, ormanagedruleset. -
resource-name: Specify the name that you gave the Amazon WAF resource, or specify a wildcard (*) to indicate all resources that satisfy the other specifications in the ARN. You must either specify the resource name and resource ID or specify a wildcard for both. -
resource-id: Specify the ID of the Amazon WAF resource, or specify a wildcard (*) to indicate all resources that satisfy the other specifications in the ARN. You must either specify the resource name and resource ID or specify a wildcard for both.
For example, the following ARN specifies all protection packs (web ACLs) with regional scope for the
account 111122223333 in Region us-west-1:
arn:aws:wafv2:us-west-1:111122223333:regional/webacl/*/*
The following ARN specifies the rule group named MyIPManagementRuleGroup with
global scope for the account 111122223333 in Region
us-east-1:
arn:aws:wafv2:us-east-1:111122223333:global/rulegroup/MyIPManagementRuleGroup/1111aaaa-bbbb-cccc-dddd-example-id
To view examples of Amazon WAF identity-based policies, see Identity-based policy examples for Amazon WAF.
Policy condition keys for Amazon WAF
Supports service-specific policy condition keys: Yes
Administrators can use Amazon JSON policies to specify who has access to what. That is, which principal can perform actions on what resources, and under what conditions.
The Condition element specifies when statements execute based on defined criteria. You can create conditional expressions that use condition
operators, such as equals or less than, to match the condition in the
policy with values in the request. To see all Amazon global
condition keys, see Amazon global condition context keys in the
IAM User Guide.
In addition, Amazon WAF supports the following condition keys that you can use to provide fine-grained filtering for your IAM policies:
-
wafv2:LogDestinationResource
This condition key takes an Amazon Resource Name (ARN) specification for the logging destination. This is the ARN that you provide for the logging destination when you use the REST API call
PutLoggingConfiguration.You can explicitly specify an ARN and you can specify filtering for the ARN. The following example specifies filtering for Amazon S3 bucket ARNs that have a specific location and prefix.
"Condition": { "ArnLike": { "wafv2:LogDestinationResource": "arn:aws:s3:::aws-waf-logs-suffix/custom-prefix/*" } } -
wafv2:LogScope
This condition key defines the source of the logging configuration in a string. Currently, this is always set to the default of
Customer, which indicates that the logging destination is owned and managed by you.
To see a list of Amazon WAF condition keys, see Condition keys for Amazon WAF V2 in the Service Authorization Reference. To learn with which actions and resources you can use a condition key, see Actions defined by Amazon WAF V2.
To view examples of Amazon WAF identity-based policies, see Identity-based policy examples for Amazon WAF.
ACLs in Amazon WAF
Supports ACLs: No
Access control lists (ACLs) control which principals (account members, users, or roles) have permissions to access a resource. ACLs are similar to resource-based policies, although they do not use the JSON policy document format.
ABAC with Amazon WAF
Supports ABAC (tags in policies): Partial
Attribute-based access control (ABAC) is an authorization strategy that defines permissions based on attributes called tags. You can attach tags to IAM entities and Amazon resources, then design ABAC policies to allow operations when the principal's tag matches the tag on the resource.
To control access based on tags, you provide tag information in the condition element of a policy using the aws:ResourceTag/,
key-nameaws:RequestTag/, or key-nameaws:TagKeys condition keys.
If a service supports all three condition keys for every resource type, then the value is Yes for the service. If a service supports all three condition keys for only some resource types, then the value is Partial.
For more information about ABAC, see Define permissions with ABAC authorization in the IAM User Guide. To view a tutorial with steps for setting up ABAC, see Use attribute-based access control (ABAC) in the IAM User Guide.
Using temporary credentials with Amazon WAF
Supports temporary credentials: Yes
Temporary credentials provide short-term access to Amazon resources and are automatically created when you use federation or switch roles. Amazon recommends that you dynamically generate temporary credentials instead of using long-term access keys. For more information, see Temporary security credentials in IAM and Amazon Web Services services that work with IAM in the IAM User Guide.
Forward access sessions for service Amazon WAF
Supports forward access sessions (FAS): Yes
Forward access sessions (FAS) use the permissions of the principal calling an Amazon Web Services service, combined with the requesting Amazon Web Services service to make requests to downstream services. For policy details when making FAS requests, see Forward access sessions.
Service roles for Amazon WAF
Supports service roles: Yes
A service role is an IAM role that a service assumes to perform actions on your behalf. An IAM administrator can create, modify, and delete a service role from within IAM. For more information, see Create a role to delegate permissions to an Amazon Web Services service in the IAM User Guide.
Warning
Changing the permissions for a service role might break Amazon WAF functionality. Edit service roles only when Amazon WAF provides guidance to do so.
Service-linked roles for Amazon WAF
Supports service-linked roles: Yes
A service-linked role is a type of service role that is linked to an Amazon Web Services service. The service can assume the role to perform an action on your behalf. Service-linked roles appear in your Amazon Web Services account and are owned by the service. An IAM administrator can view, but not edit the permissions for service-linked roles.
For details about creating or managing Amazon WAF service-linked roles, see Using service-linked roles for Amazon WAF.