createWebAcl
This is AWS WAF Classic documentation. For more information, see AWS WAF Classic in the developer guide.
For the latest version of AWS WAF, use the AWS WAFV2 API and see the AWS WAF Developer Guide. With the latest version, AWS WAF has a single set of endpoints for regional and global use.
Creates a WebACL, which contains the Rules that identify the CloudFront web requests that you want to allow, block, or count. AWS WAF evaluates Rules in order based on the value of Priority for each Rule.
You also specify a default action, either ALLOW or BLOCK. If a web request doesn't match any of the Rules in a WebACL, AWS WAF responds to the request with the default action.
To create and configure a WebACL, perform the following steps:
Create and update the
ByteMatchSetobjects and other predicates that you want to include inRules. For more information, see CreateByteMatchSet, UpdateByteMatchSet, CreateIPSet, UpdateIPSet, CreateSqlInjectionMatchSet, and UpdateSqlInjectionMatchSet.Create and update the
Rulesthat you want to include in theWebACL. For more information, see CreateRule and UpdateRule.Use GetChangeToken to get the change token that you provide in the
ChangeTokenparameter of aCreateWebACLrequest.Submit a
CreateWebACLrequest.Use
GetChangeTokento get the change token that you provide in theChangeTokenparameter of an UpdateWebACL request.Submit an UpdateWebACL request to specify the
Rulesthat you want to include in theWebACL, to specify the default action, and to associate theWebACLwith a CloudFront distribution.
For more information about how to use the AWS WAF API, see the AWS WAF Developer Guide.
Samples
import aws.sdk.kotlin.services.waf.model.WafAction
import aws.sdk.kotlin.services.waf.model.WafActionType
fun main() {
//sampleStart
// The following example creates a web ACL named CreateExample.
val resp = wafClient.createWebAcl {
name = "CreateExample"
metricName = "CreateExample"
defaultAction = WafAction {
type = WafActionType.fromValue("ALLOW")
}
changeToken = "abcd12f2-46da-4fdb-b8d5-fbd4c466928f"
}
//sampleEnd
}