Skip to content

WAFv2

CloudMock emulates AWS WAFv2, supporting Web ACLs, rule groups, IP sets, regex pattern sets, resource associations, logging, request sampling, and tagging. Includes a basic rule evaluation engine.

OperationStatusNotes
CreateWebACLSupportedCreates a Web ACL
GetWebACLSupportedReturns Web ACL details
ListWebACLsSupportedLists Web ACLs
UpdateWebACLSupportedUpdates a Web ACL
DeleteWebACLSupportedDeletes a Web ACL
CreateRuleGroupSupportedCreates a rule group
GetRuleGroupSupportedReturns rule group details
ListRuleGroupsSupportedLists rule groups
UpdateRuleGroupSupportedUpdates a rule group
DeleteRuleGroupSupportedDeletes a rule group
CreateIPSetSupportedCreates an IP set
GetIPSetSupportedReturns IP set details
ListIPSetsSupportedLists IP sets
UpdateIPSetSupportedUpdates an IP set
DeleteIPSetSupportedDeletes an IP set
CreateRegexPatternSetSupportedCreates a regex pattern set
GetRegexPatternSetSupportedReturns regex pattern set details
ListRegexPatternSetsSupportedLists regex pattern sets
DeleteRegexPatternSetSupportedDeletes a regex pattern set
GetSampledRequestsSupportedReturns sampled requests
AssociateWebACLSupportedAssociates a Web ACL with a resource
DisassociateWebACLSupportedDisassociates a Web ACL
GetWebACLForResourceSupportedReturns the Web ACL for a resource
PutLoggingConfigurationSupportedConfigures logging for a Web ACL
GetLoggingConfigurationSupportedReturns logging configuration
DeleteLoggingConfigurationSupportedRemoves logging configuration
TagResourceSupportedAdds tags to a resource
UntagResourceSupportedRemoves tags from a resource
ListTagsForResourceSupportedLists tags for a resource
import { WAFV2Client, CreateWebACLCommand } from '@aws-sdk/client-wafv2';
const client = new WAFV2Client({
endpoint: 'http://localhost:4566',
region: 'us-east-1',
credentials: { accessKeyId: 'test', secretAccessKey: 'test' },
});
const { Summary } = await client.send(new CreateWebACLCommand({
Name: 'my-web-acl',
Scope: 'REGIONAL',
DefaultAction: { Allow: {} },
VisibilityConfig: { SampledRequestsEnabled: true, CloudWatchMetricsEnabled: true, MetricName: 'myWebAcl' },
Rules: [],
}));
console.log(Summary.Id);
import boto3
client = boto3.client('wafv2',
endpoint_url='http://localhost:4566',
region_name='us-east-1',
aws_access_key_id='test',
aws_secret_access_key='test')
response = client.create_web_acl(
Name='my-web-acl',
Scope='REGIONAL',
DefaultAction={'Allow': {}},
VisibilityConfig={'SampledRequestsEnabled': True, 'CloudWatchMetricsEnabled': True, 'MetricName': 'myWebAcl'},
Rules=[])
print(response['Summary']['Id'])
cloudmock.yml
services:
wafv2:
enabled: true
  • Rule evaluation is basic and may not match all AWS WAF rule types
  • Managed rule groups are not available
  • Sampled requests return stub data
  • Logging configuration is stored but logs are not delivered