I have a problem with finding a mistake. I'm trying to connect WafACL to API Gateway Deployment and I'm using such command:
aws wafv2 associate-web-acl --web-acl-arn d3b11jj1-30c6-46ae-8e58-6a90ae69eeaf --resource-arn 'arn:aws:apigateway:us-east-1::/restapis/*api-id*/stages/dev'
An error occurred (WAFInvalidParameterException) when calling the AssociateWebACL operation: Error reason: The ARN isn’t valid. A valid ARN begins with arn: and includes other information separated by colons or slashes., field: RESOURCE_ARN, parameter: d3b11jj1-30c6-46ae-8e58-6a90ae69eeaf
I tried also to use CloudFormation:
AWSTemplateFormatVersion: "2010-09-09"
Description: "DB Management Service"
Resources:
WebACLAssociation:
Type: AWS::WAFv2::WebACLAssociation
Properties:
ResourceArn: 'arn:aws:apigateway:us-east-1::/restapis/*api-id*/stages/dev'
WebACLArn:
Ref: WebACL
WebACL:
Type: AWS::WAFv2::WebACL
Properties:
DefaultAction:
Allow: {}
Rules:
- Name: WebACLRule
Action:
Block: {}
Priority: 0
Statement:
RateBasedStatement:
AggregateKeyType: IP
Limit: 2048
VisibilityConfig:
CloudWatchMetricsEnabled: true
MetricName: Requests
SampledRequestsEnabled: false
Scope: REGIONAL
VisibilityConfig:
CloudWatchMetricsEnabled: true
MetricName: WafACL
SampledRequestsEnabled: true
But here I also get:
Error reason: The ARN isn?t valid. A valid ARN begins with arn: and includes other information separated by colons or slashes., field: RESOURCE_ARN
I don't think that Arn is incorrect. I tried use it on various combinations.