Package: aws-solutions-constructs.aws-wafwebacl-apigateway
aws-wafwebacl-apigateway module---All classes are under active development and subject to non-backward compatible changes or removal in any
future version. These are not subject to theSemantic Versioningmodel.
This means that while you may use them, you may need to update your source code when upgrading to a newer version of this package.Reference Documentation:https://docs.aws.amazon.com/solutions/latest/constructs/LanguagePackagePythonaws_solutions_constructs.aws_wafwebacl_apigatewayTypescript@aws-solutions-constructs/aws-wafwebacl-apigatewayJavasoftware.amazon.awsconstructs.services.wafwebaclapigatewayOverviewThis AWS Solutions Construct implements an AWS WAF web ACL connected to Amazon API Gateway REST API.Here is a minimal deployable pattern definition:Typescriptimport{Construct}from'constructs';import{Stack,StackProps}from'aws-cdk-lib';import*aslambdafrom"aws-cdk-lib/aws-lambda";import{ApiGatewayToLambda}from'@aws-solutions-constructs/aws-apigateway-lambda';import{WafwebaclToApiGatewayProps,WafwebaclToApiGateway}from"@aws-solutions-constructs/aws-wafwebacl-apigateway";constapiGatewayToLambda=newApiGatewayToLambda(this,'ApiGatewayToLambdaPattern',{lambdaFunctionProps:{runtime:lambda.Runtime.NODEJS_16_X,handler:'index.handler',code:lambda.Code.fromAsset(`lambda`)}});//ThisconstructcanonlybeattachedtoaconfiguredAPIGateway.newWafwebaclToApiGateway(this,'test-wafwebacl-apigateway',{existingApiGatewayInterface:apiGatewayToLambda.apiGateway});Pythonfromaws_solutions_constructs.aws_apigateway_lambdaimportApiGatewayToLambdafromaws_solutions_constructs.aws_wafwebacl_apigatewayimportWafwebaclToApiGatewayProps,WafwebaclToApiGatewayfromaws_cdkimport(aws_apigatewayasapi,aws_lambdaas_lambda,Stack)fromconstructsimportConstructapi_gateway_to_lambda=ApiGatewayToLambda(self,'ApiGatewayToLambdaPattern',lambda_function_props=_lambda.FunctionProps(code=_lambda.Code.from_asset('lambda'),runtime=_lambda.Runtime.PYTHON_3_9,handler='index.handler'))# This construct can only be attached to a configured API Gateway.WafwebaclToApiGateway(self,'test_wafwebacl_apigateway',existing_api_gateway_interface=api_gateway_to_lambda.api_gateway)Javaimportsoftware.constructs.Construct;importsoftware.amazon.awscdk.Stack;importsoftware.amazon.awscdk.StackProps;importsoftware.amazon.awscdk.services.apigateway.*;importsoftware.amazon.awscdk.services.lambda.*;importsoftware.amazon.awscdk.services.lambda.Runtime;importsoftware.amazon.awsconstructs.services.apigatewaylambda.*;importsoftware.amazon.awsconstructs.services.wafwebaclapigateway.*;finalApiGatewayToLambdaapiGatewayToLambda=newApiGatewayToLambda(this,"ApiGatewayToLambdaPattern",newApiGatewayToLambdaProps.Builder().lambdaFunctionProps(newFunctionProps.Builder().runtime(Runtime.NODEJS_16_X).code(Code.fromAsset("lambda")).handler("index.handler").build()).build());// This construct can only be attached to a configured Application Load// Balancer.newWafwebaclToApiGateway(this,"test-wafwebacl-apigateway",newWafwebaclToApiGatewayProps.Builder().existingApiGatewayInterface(apiGatewayToLambda.getApiGateway()).build());Pattern Construct PropsNameTypeDescriptionexistingApiGatewayInterfaceapi.IRestApiThe existing API Gateway instance that will be protected with the WAF web ACL.Note that a WAF web ACL can only be added to a configured API Gateway, so this construct only accepts an existing IRestApi and does not accept apiGatewayProps.existingWebaclObj?waf.CfnWebACLExisting instance of a WAF web ACL, an error will occur if this and props is set.webaclProps?waf.CfnWebACLPropsOptional user-provided props to override the default props for the AWS WAF web ACL. To use a different collection of managed rule sets, specify a new rules property. Use ourwrapManagedRuleSet(managedGroupName: string, vendorName: string, priority: number)function from core to create an array entry from each desired managed rule set.Pattern PropertiesNameTypeDescriptionwebaclwaf.CfnWebACLReturns an instance of the waf.CfnWebACL created by the construct.apiGatewayapi.IRestApiReturns an instance of the API Gateway REST API created by the pattern.Default settingsOut of the box implementation of the Construct without any override will set the following defaults:AWS WAFDeploy a WAF web ACL with 7AWS managed rule groups.AWSManagedRulesBotControlRuleSetAWSManagedRulesKnownBadInputsRuleSetAWSManagedRulesCommonRuleSetAWSManagedRulesAnonymousIpListAWSManagedRulesAmazonIpReputationListAWSManagedRulesAdminProtectionRuleSetAWSManagedRulesSQLiRuleSetNote that the default rules can be replaced by specifying the rules property of CfnWebACLPropsSend metrics to Amazon CloudWatchAmazon API GatewayUser provided API Gateway object is used as-isArchitecture© Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.