1. Packages
  2. AWS Classic
  3. API Docs
  4. waf
  5. RateBasedRule

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.10.0 published on Tuesday, Nov 21, 2023 by Pulumi

aws.waf.RateBasedRule

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.10.0 published on Tuesday, Nov 21, 2023 by Pulumi

    Provides a WAF Rate Based Rule Resource

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var ipset = new Aws.Waf.IpSet("ipset", new()
        {
            IpSetDescriptors = new[]
            {
                new Aws.Waf.Inputs.IpSetIpSetDescriptorArgs
                {
                    Type = "IPV4",
                    Value = "192.0.7.0/24",
                },
            },
        });
    
        var wafrule = new Aws.Waf.RateBasedRule("wafrule", new()
        {
            MetricName = "tfWAFRule",
            RateKey = "IP",
            RateLimit = 100,
            Predicates = new[]
            {
                new Aws.Waf.Inputs.RateBasedRulePredicateArgs
                {
                    DataId = ipset.Id,
                    Negated = false,
                    Type = "IPMatch",
                },
            },
        }, new CustomResourceOptions
        {
            DependsOn = new[]
            {
                ipset,
            },
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/waf"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		ipset, err := waf.NewIpSet(ctx, "ipset", &waf.IpSetArgs{
    			IpSetDescriptors: waf.IpSetIpSetDescriptorArray{
    				&waf.IpSetIpSetDescriptorArgs{
    					Type:  pulumi.String("IPV4"),
    					Value: pulumi.String("192.0.7.0/24"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = waf.NewRateBasedRule(ctx, "wafrule", &waf.RateBasedRuleArgs{
    			MetricName: pulumi.String("tfWAFRule"),
    			RateKey:    pulumi.String("IP"),
    			RateLimit:  pulumi.Int(100),
    			Predicates: waf.RateBasedRulePredicateArray{
    				&waf.RateBasedRulePredicateArgs{
    					DataId:  ipset.ID(),
    					Negated: pulumi.Bool(false),
    					Type:    pulumi.String("IPMatch"),
    				},
    			},
    		}, pulumi.DependsOn([]pulumi.Resource{
    			ipset,
    		}))
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.waf.IpSet;
    import com.pulumi.aws.waf.IpSetArgs;
    import com.pulumi.aws.waf.inputs.IpSetIpSetDescriptorArgs;
    import com.pulumi.aws.waf.RateBasedRule;
    import com.pulumi.aws.waf.RateBasedRuleArgs;
    import com.pulumi.aws.waf.inputs.RateBasedRulePredicateArgs;
    import com.pulumi.resources.CustomResourceOptions;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var ipset = new IpSet("ipset", IpSetArgs.builder()        
                .ipSetDescriptors(IpSetIpSetDescriptorArgs.builder()
                    .type("IPV4")
                    .value("192.0.7.0/24")
                    .build())
                .build());
    
            var wafrule = new RateBasedRule("wafrule", RateBasedRuleArgs.builder()        
                .metricName("tfWAFRule")
                .rateKey("IP")
                .rateLimit(100)
                .predicates(RateBasedRulePredicateArgs.builder()
                    .dataId(ipset.id())
                    .negated(false)
                    .type("IPMatch")
                    .build())
                .build(), CustomResourceOptions.builder()
                    .dependsOn(ipset)
                    .build());
    
        }
    }
    
    import pulumi
    import pulumi_aws as aws
    
    ipset = aws.waf.IpSet("ipset", ip_set_descriptors=[aws.waf.IpSetIpSetDescriptorArgs(
        type="IPV4",
        value="192.0.7.0/24",
    )])
    wafrule = aws.waf.RateBasedRule("wafrule",
        metric_name="tfWAFRule",
        rate_key="IP",
        rate_limit=100,
        predicates=[aws.waf.RateBasedRulePredicateArgs(
            data_id=ipset.id,
            negated=False,
            type="IPMatch",
        )],
        opts=pulumi.ResourceOptions(depends_on=[ipset]))
    
    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const ipset = new aws.waf.IpSet("ipset", {ipSetDescriptors: [{
        type: "IPV4",
        value: "192.0.7.0/24",
    }]});
    const wafrule = new aws.waf.RateBasedRule("wafrule", {
        metricName: "tfWAFRule",
        rateKey: "IP",
        rateLimit: 100,
        predicates: [{
            dataId: ipset.id,
            negated: false,
            type: "IPMatch",
        }],
    }, {
        dependsOn: [ipset],
    });
    
    resources:
      ipset:
        type: aws:waf:IpSet
        properties:
          ipSetDescriptors:
            - type: IPV4
              value: 192.0.7.0/24
      wafrule:
        type: aws:waf:RateBasedRule
        properties:
          metricName: tfWAFRule
          rateKey: IP
          rateLimit: 100
          predicates:
            - dataId: ${ipset.id}
              negated: false
              type: IPMatch
        options:
          dependson:
            - ${ipset}
    

    Create RateBasedRule Resource

    new RateBasedRule(name: string, args: RateBasedRuleArgs, opts?: CustomResourceOptions);
    @overload
    def RateBasedRule(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      metric_name: Optional[str] = None,
                      name: Optional[str] = None,
                      predicates: Optional[Sequence[RateBasedRulePredicateArgs]] = None,
                      rate_key: Optional[str] = None,
                      rate_limit: Optional[int] = None,
                      tags: Optional[Mapping[str, str]] = None)
    @overload
    def RateBasedRule(resource_name: str,
                      args: RateBasedRuleArgs,
                      opts: Optional[ResourceOptions] = None)
    func NewRateBasedRule(ctx *Context, name string, args RateBasedRuleArgs, opts ...ResourceOption) (*RateBasedRule, error)
    public RateBasedRule(string name, RateBasedRuleArgs args, CustomResourceOptions? opts = null)
    public RateBasedRule(String name, RateBasedRuleArgs args)
    public RateBasedRule(String name, RateBasedRuleArgs args, CustomResourceOptions options)
    
    type: aws:waf:RateBasedRule
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args RateBasedRuleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args RateBasedRuleArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args RateBasedRuleArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args RateBasedRuleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args RateBasedRuleArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    RateBasedRule Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The RateBasedRule resource accepts the following input properties:

    MetricName string

    The name or description for the Amazon CloudWatch metric of this rule.

    RateKey string

    Valid value is IP.

    RateLimit int

    The maximum number of requests, which have an identical value in the field specified by the RateKey, allowed in a five-minute period. Minimum value is 100.

    Name string

    The name or description of the rule.

    Predicates List<RateBasedRulePredicate>

    The objects to include in a rule (documented below).

    Tags Dictionary<string, string>

    Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    MetricName string

    The name or description for the Amazon CloudWatch metric of this rule.

    RateKey string

    Valid value is IP.

    RateLimit int

    The maximum number of requests, which have an identical value in the field specified by the RateKey, allowed in a five-minute period. Minimum value is 100.

    Name string

    The name or description of the rule.

    Predicates []RateBasedRulePredicateArgs

    The objects to include in a rule (documented below).

    Tags map[string]string

    Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    metricName String

    The name or description for the Amazon CloudWatch metric of this rule.

    rateKey String

    Valid value is IP.

    rateLimit Integer

    The maximum number of requests, which have an identical value in the field specified by the RateKey, allowed in a five-minute period. Minimum value is 100.

    name String

    The name or description of the rule.

    predicates List<RateBasedRulePredicate>

    The objects to include in a rule (documented below).

    tags Map<String,String>

    Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    metricName string

    The name or description for the Amazon CloudWatch metric of this rule.

    rateKey string

    Valid value is IP.

    rateLimit number

    The maximum number of requests, which have an identical value in the field specified by the RateKey, allowed in a five-minute period. Minimum value is 100.

    name string

    The name or description of the rule.

    predicates RateBasedRulePredicate[]

    The objects to include in a rule (documented below).

    tags {[key: string]: string}

    Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    metric_name str

    The name or description for the Amazon CloudWatch metric of this rule.

    rate_key str

    Valid value is IP.

    rate_limit int

    The maximum number of requests, which have an identical value in the field specified by the RateKey, allowed in a five-minute period. Minimum value is 100.

    name str

    The name or description of the rule.

    predicates Sequence[RateBasedRulePredicateArgs]

    The objects to include in a rule (documented below).

    tags Mapping[str, str]

    Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    metricName String

    The name or description for the Amazon CloudWatch metric of this rule.

    rateKey String

    Valid value is IP.

    rateLimit Number

    The maximum number of requests, which have an identical value in the field specified by the RateKey, allowed in a five-minute period. Minimum value is 100.

    name String

    The name or description of the rule.

    predicates List<Property Map>

    The objects to include in a rule (documented below).

    tags Map<String>

    Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the RateBasedRule resource produces the following output properties:

    Arn string

    Amazon Resource Name (ARN)

    Id string

    The provider-assigned unique ID for this managed resource.

    TagsAll Dictionary<string, string>

    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated:

    Please use tags instead.

    Arn string

    Amazon Resource Name (ARN)

    Id string

    The provider-assigned unique ID for this managed resource.

    TagsAll map[string]string

    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated:

    Please use tags instead.

    arn String

    Amazon Resource Name (ARN)

    id String

    The provider-assigned unique ID for this managed resource.

    tagsAll Map<String,String>

    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated:

    Please use tags instead.

    arn string

    Amazon Resource Name (ARN)

    id string

    The provider-assigned unique ID for this managed resource.

    tagsAll {[key: string]: string}

    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated:

    Please use tags instead.

    arn str

    Amazon Resource Name (ARN)

    id str

    The provider-assigned unique ID for this managed resource.

    tags_all Mapping[str, str]

    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated:

    Please use tags instead.

    arn String

    Amazon Resource Name (ARN)

    id String

    The provider-assigned unique ID for this managed resource.

    tagsAll Map<String>

    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated:

    Please use tags instead.

    Look up Existing RateBasedRule Resource

    Get an existing RateBasedRule resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: RateBasedRuleState, opts?: CustomResourceOptions): RateBasedRule
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            arn: Optional[str] = None,
            metric_name: Optional[str] = None,
            name: Optional[str] = None,
            predicates: Optional[Sequence[RateBasedRulePredicateArgs]] = None,
            rate_key: Optional[str] = None,
            rate_limit: Optional[int] = None,
            tags: Optional[Mapping[str, str]] = None,
            tags_all: Optional[Mapping[str, str]] = None) -> RateBasedRule
    func GetRateBasedRule(ctx *Context, name string, id IDInput, state *RateBasedRuleState, opts ...ResourceOption) (*RateBasedRule, error)
    public static RateBasedRule Get(string name, Input<string> id, RateBasedRuleState? state, CustomResourceOptions? opts = null)
    public static RateBasedRule get(String name, Output<String> id, RateBasedRuleState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Arn string

    Amazon Resource Name (ARN)

    MetricName string

    The name or description for the Amazon CloudWatch metric of this rule.

    Name string

    The name or description of the rule.

    Predicates List<RateBasedRulePredicate>

    The objects to include in a rule (documented below).

    RateKey string

    Valid value is IP.

    RateLimit int

    The maximum number of requests, which have an identical value in the field specified by the RateKey, allowed in a five-minute period. Minimum value is 100.

    Tags Dictionary<string, string>

    Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    TagsAll Dictionary<string, string>

    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated:

    Please use tags instead.

    Arn string

    Amazon Resource Name (ARN)

    MetricName string

    The name or description for the Amazon CloudWatch metric of this rule.

    Name string

    The name or description of the rule.

    Predicates []RateBasedRulePredicateArgs

    The objects to include in a rule (documented below).

    RateKey string

    Valid value is IP.

    RateLimit int

    The maximum number of requests, which have an identical value in the field specified by the RateKey, allowed in a five-minute period. Minimum value is 100.

    Tags map[string]string

    Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    TagsAll map[string]string

    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated:

    Please use tags instead.

    arn String

    Amazon Resource Name (ARN)

    metricName String

    The name or description for the Amazon CloudWatch metric of this rule.

    name String

    The name or description of the rule.

    predicates List<RateBasedRulePredicate>

    The objects to include in a rule (documented below).

    rateKey String

    Valid value is IP.

    rateLimit Integer

    The maximum number of requests, which have an identical value in the field specified by the RateKey, allowed in a five-minute period. Minimum value is 100.

    tags Map<String,String>

    Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    tagsAll Map<String,String>

    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated:

    Please use tags instead.

    arn string

    Amazon Resource Name (ARN)

    metricName string

    The name or description for the Amazon CloudWatch metric of this rule.

    name string

    The name or description of the rule.

    predicates RateBasedRulePredicate[]

    The objects to include in a rule (documented below).

    rateKey string

    Valid value is IP.

    rateLimit number

    The maximum number of requests, which have an identical value in the field specified by the RateKey, allowed in a five-minute period. Minimum value is 100.

    tags {[key: string]: string}

    Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    tagsAll {[key: string]: string}

    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated:

    Please use tags instead.

    arn str

    Amazon Resource Name (ARN)

    metric_name str

    The name or description for the Amazon CloudWatch metric of this rule.

    name str

    The name or description of the rule.

    predicates Sequence[RateBasedRulePredicateArgs]

    The objects to include in a rule (documented below).

    rate_key str

    Valid value is IP.

    rate_limit int

    The maximum number of requests, which have an identical value in the field specified by the RateKey, allowed in a five-minute period. Minimum value is 100.

    tags Mapping[str, str]

    Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    tags_all Mapping[str, str]

    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated:

    Please use tags instead.

    arn String

    Amazon Resource Name (ARN)

    metricName String

    The name or description for the Amazon CloudWatch metric of this rule.

    name String

    The name or description of the rule.

    predicates List<Property Map>

    The objects to include in a rule (documented below).

    rateKey String

    Valid value is IP.

    rateLimit Number

    The maximum number of requests, which have an identical value in the field specified by the RateKey, allowed in a five-minute period. Minimum value is 100.

    tags Map<String>

    Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    tagsAll Map<String>

    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated:

    Please use tags instead.

    Supporting Types

    RateBasedRulePredicate, RateBasedRulePredicateArgs

    DataId string

    A unique identifier for a predicate in the rule, such as Byte Match Set ID or IPSet ID.

    Negated bool

    Set this to false if you want to allow, block, or count requests based on the settings in the specified ByteMatchSet, IPSet, SqlInjectionMatchSet, XssMatchSet, or SizeConstraintSet. For example, if an IPSet includes the IP address 192.0.2.44, AWS WAF will allow or block requests based on that IP address. If set to true, AWS WAF will allow, block, or count requests based on all IP addresses except 192.0.2.44.

    Type string

    The type of predicate in a rule. Valid values: ByteMatch, GeoMatch, IPMatch, RegexMatch, SizeConstraint, SqlInjectionMatch, or XssMatch.

    DataId string

    A unique identifier for a predicate in the rule, such as Byte Match Set ID or IPSet ID.

    Negated bool

    Set this to false if you want to allow, block, or count requests based on the settings in the specified ByteMatchSet, IPSet, SqlInjectionMatchSet, XssMatchSet, or SizeConstraintSet. For example, if an IPSet includes the IP address 192.0.2.44, AWS WAF will allow or block requests based on that IP address. If set to true, AWS WAF will allow, block, or count requests based on all IP addresses except 192.0.2.44.

    Type string

    The type of predicate in a rule. Valid values: ByteMatch, GeoMatch, IPMatch, RegexMatch, SizeConstraint, SqlInjectionMatch, or XssMatch.

    dataId String

    A unique identifier for a predicate in the rule, such as Byte Match Set ID or IPSet ID.

    negated Boolean

    Set this to false if you want to allow, block, or count requests based on the settings in the specified ByteMatchSet, IPSet, SqlInjectionMatchSet, XssMatchSet, or SizeConstraintSet. For example, if an IPSet includes the IP address 192.0.2.44, AWS WAF will allow or block requests based on that IP address. If set to true, AWS WAF will allow, block, or count requests based on all IP addresses except 192.0.2.44.

    type String

    The type of predicate in a rule. Valid values: ByteMatch, GeoMatch, IPMatch, RegexMatch, SizeConstraint, SqlInjectionMatch, or XssMatch.

    dataId string

    A unique identifier for a predicate in the rule, such as Byte Match Set ID or IPSet ID.

    negated boolean

    Set this to false if you want to allow, block, or count requests based on the settings in the specified ByteMatchSet, IPSet, SqlInjectionMatchSet, XssMatchSet, or SizeConstraintSet. For example, if an IPSet includes the IP address 192.0.2.44, AWS WAF will allow or block requests based on that IP address. If set to true, AWS WAF will allow, block, or count requests based on all IP addresses except 192.0.2.44.

    type string

    The type of predicate in a rule. Valid values: ByteMatch, GeoMatch, IPMatch, RegexMatch, SizeConstraint, SqlInjectionMatch, or XssMatch.

    data_id str

    A unique identifier for a predicate in the rule, such as Byte Match Set ID or IPSet ID.

    negated bool

    Set this to false if you want to allow, block, or count requests based on the settings in the specified ByteMatchSet, IPSet, SqlInjectionMatchSet, XssMatchSet, or SizeConstraintSet. For example, if an IPSet includes the IP address 192.0.2.44, AWS WAF will allow or block requests based on that IP address. If set to true, AWS WAF will allow, block, or count requests based on all IP addresses except 192.0.2.44.

    type str

    The type of predicate in a rule. Valid values: ByteMatch, GeoMatch, IPMatch, RegexMatch, SizeConstraint, SqlInjectionMatch, or XssMatch.

    dataId String

    A unique identifier for a predicate in the rule, such as Byte Match Set ID or IPSet ID.

    negated Boolean

    Set this to false if you want to allow, block, or count requests based on the settings in the specified ByteMatchSet, IPSet, SqlInjectionMatchSet, XssMatchSet, or SizeConstraintSet. For example, if an IPSet includes the IP address 192.0.2.44, AWS WAF will allow or block requests based on that IP address. If set to true, AWS WAF will allow, block, or count requests based on all IP addresses except 192.0.2.44.

    type String

    The type of predicate in a rule. Valid values: ByteMatch, GeoMatch, IPMatch, RegexMatch, SizeConstraint, SqlInjectionMatch, or XssMatch.

    Import

    Using pulumi import, import WAF Rated Based Rule using the id. For example:

     $ pulumi import aws:waf/rateBasedRule:RateBasedRule wafrule a1b2c3d4-d5f6-7777-8888-9999aaaabbbbcccc
    

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes

    This Pulumi package is based on the aws Terraform Provider.

    aws logo

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.10.0 published on Tuesday, Nov 21, 2023 by Pulumi