Files
floci/docs/services/wafv2.md
T
Hector Ventura da53fc1c05 docs(partition): document deployment, test coverage and known gaps (#5292)
* docs(partition): document deployment, test coverage and known gaps

partitions.md said every partition-dependent rule had integration tests
over all eight partitions and that the China compat allowlist only
shrinks. Neither is accurate now: most services are tested in China
alone, and the allowlist is empty. The page now states the coverage as
it is (unit tests over every partition, IAM, Step Functions and the
cross-service smoke test through the emulator, China end to end), gives
a recipe for running a China, GovCloud, ISO or EUSC deployment, and
lists the known gaps: global state shared across partitions in one
process (now naming the Identity Center instance, which the smoke
test's inventory exempts for that reason), the commercial managed-policy
catalog, and client tooling untested outside the commercial partition.

API Gateway, IAM and Step Functions gain a Partitions section, and the
WAFv2 scope note names the partition's CloudFront region and where the
CLOUDFRONT scope exists.

* docs(partition): say only custom domains refuse EDGE, and when FLOCI_HOSTNAME is enough

The API Gateway Partitions section said EDGE was refused outside the
commercial partition and that REGIONAL and PRIVATE worked everywhere.
Only custom domains are checked: createRestApi and the REST API update
path accept EDGE in any partition, and createDomainName refuses PRIVATE
in all of them. The section now says so.

The deployment recipe offered FLOCI_HOSTNAME for a different port, but
it replaces only the host and keeps FLOCI_BASE_URL's port, so a
different port needs FLOCI_BASE_URL.
2026-10-07 23:47:52 -04:00

82 lines
4.5 KiB
Markdown

# WAF v2
**Protocol:** JSON 1.1
**Endpoint:** `http://localhost:4566/`
**Target prefix:** `X-Amz-Target: AWSWAF_20190729.*`
Floci emulates the AWS WAF v2 management API. Web ACLs, IP sets, regex pattern sets, rule groups, logging configurations, permission policies, tags, and resource associations are persisted in Floci's storage backend. Floci does not inspect or filter live traffic — this surface lets you create, read, update, and delete WAF resources and validate IaC (CloudFormation/CDK/Terraform) locally.
## Supported Actions
<!-- floci:actions:start -->
| Action | Description |
| --- | --- |
| `CreateWebACL` | Creates a web ACL |
| `GetWebACL` | Returns a web ACL by name/id/scope |
| `UpdateWebACL` | Updates a web ACL (requires the current `LockToken`) |
| `DeleteWebACL` | Deletes a web ACL |
| `ListWebACLs` | Lists web ACLs for a scope |
| `CreateIPSet` | Creates an IP set |
| `GetIPSet` | Returns an IP set |
| `UpdateIPSet` | Updates an IP set |
| `DeleteIPSet` | Deletes an IP set |
| `ListIPSets` | Lists IP sets for a scope |
| `CreateRegexPatternSet` | Creates a regex pattern set |
| `GetRegexPatternSet` | Returns a regex pattern set |
| `UpdateRegexPatternSet` | Updates a regex pattern set |
| `DeleteRegexPatternSet` | Deletes a regex pattern set |
| `ListRegexPatternSets` | Lists regex pattern sets for a scope |
| `CreateRuleGroup` | Creates a rule group |
| `GetRuleGroup` | Returns a rule group |
| `UpdateRuleGroup` | Updates a rule group |
| `DeleteRuleGroup` | Deletes a rule group |
| `ListRuleGroups` | Lists rule groups for a scope |
| `CheckCapacity` | Returns the WCU capacity required for a set of rules |
| `AssociateWebACL` | Associates a web ACL with a resource |
| `DisassociateWebACL` | Removes a web ACL association from a resource |
| `GetWebACLForResource` | Returns the web ACL associated with a resource |
| `ListResourcesForWebACL` | Lists resources associated with a web ACL |
| `PutLoggingConfiguration` | Sets the logging configuration for a web ACL |
| `GetLoggingConfiguration` | Returns the logging configuration for a web ACL |
| `DeleteLoggingConfiguration` | Removes a logging configuration |
| `ListLoggingConfigurations` | Lists logging configurations for a scope |
| `PutPermissionPolicy` | Attaches an IAM-style policy to a rule group |
| `GetPermissionPolicy` | Returns the policy attached to a rule group |
| `DeletePermissionPolicy` | Removes the policy from a rule group |
| `TagResource` | Adds tags to a WAF resource |
| `UntagResource` | Removes tags from a WAF resource |
| `ListTagsForResource` | Lists tags for a WAF resource |
<!-- floci:actions:end -->
## Scope
WAF v2 resources are partitioned by `Scope`: `REGIONAL` (ALB, API Gateway, AppSync) or `CLOUDFRONT`. Pass `--scope` on every call; `CLOUDFRONT`-scoped requests target the partition's CloudFront region (`us-east-1`, or `cn-northwest-1` in China) as on real AWS. The `CLOUDFRONT` scope exists only where CloudFront does, the commercial and China partitions; elsewhere it is a `WAFInvalidParameterException`. See [AWS Partitions](../configuration/partitions.md).
## IP set addresses
`CreateIPSet` and `UpdateIPSet` require every entry in `Addresses` to be in CIDR notation matching the set's `IPAddressVersion`: an IPv4 address with a `/1`-`/32` prefix, or an IPv6 address with a `/1`-`/128` prefix (a `/0` prefix is rejected, matching AWS). A bare address with no prefix, a prefix outside that range, or an address that does not match the declared `IPAddressVersion` is rejected with `WAFInvalidParameterException`.
## Tags
Every WAF v2 resource accepts at most 50 tags. `TagResource`, `CreateWebACL`, `CreateIPSet`, `CreateRegexPatternSet` and `CreateRuleGroup` reject a request that would leave the resource with more than 50 tags with `WAFLimitsExceededException`; overwriting an existing key does not count toward the limit. Tag keys must be 1-128 characters and values 0-256 characters, both limited to letters, numbers, spaces and `_ . : / = + - @`. An invalid key or value is rejected with `WAFInvalidParameterException` (`Field: TAGS`, or `TAG_KEYS` for `UntagResource`).
## Example
```bash
export AWS_ENDPOINT_URL=http://localhost:4566
# Create an IP set
aws wafv2 create-ip-set \
--name blocklist --scope REGIONAL \
--ip-address-version IPV4 \
--addresses 192.0.2.0/24
# Create a web ACL that allows by default
aws wafv2 create-web-acl \
--name demo-acl --scope REGIONAL \
--default-action Allow={} \
--visibility-config SampledRequestsEnabled=true,CloudWatchMetricsEnabled=true,MetricName=demo
aws wafv2 list-web-acls --scope REGIONAL
```