aws.wafregional.RateBasedRule
Explore with Pulumi AI
Provides a WAF Rate Based Rule Resource
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const ipset = new aws.wafregional.IpSet("ipset", {
name: "tfIPSet",
ipSetDescriptors: [{
type: "IPV4",
value: "192.0.7.0/24",
}],
});
const wafrule = new aws.wafregional.RateBasedRule("wafrule", {
name: "tfWAFRule",
metricName: "tfWAFRule",
rateKey: "IP",
rateLimit: 100,
predicates: [{
dataId: ipset.id,
negated: false,
type: "IPMatch",
}],
}, {
dependsOn: [ipset],
});
import pulumi
import pulumi_aws as aws
ipset = aws.wafregional.IpSet("ipset",
name="tfIPSet",
ip_set_descriptors=[{
"type": "IPV4",
"value": "192.0.7.0/24",
}])
wafrule = aws.wafregional.RateBasedRule("wafrule",
name="tfWAFRule",
metric_name="tfWAFRule",
rate_key="IP",
rate_limit=100,
predicates=[{
"data_id": ipset.id,
"negated": False,
"type": "IPMatch",
}],
opts = pulumi.ResourceOptions(depends_on=[ipset]))
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/wafregional"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
ipset, err := wafregional.NewIpSet(ctx, "ipset", &wafregional.IpSetArgs{
Name: pulumi.String("tfIPSet"),
IpSetDescriptors: wafregional.IpSetIpSetDescriptorArray{
&wafregional.IpSetIpSetDescriptorArgs{
Type: pulumi.String("IPV4"),
Value: pulumi.String("192.0.7.0/24"),
},
},
})
if err != nil {
return err
}
_, err = wafregional.NewRateBasedRule(ctx, "wafrule", &wafregional.RateBasedRuleArgs{
Name: pulumi.String("tfWAFRule"),
MetricName: pulumi.String("tfWAFRule"),
RateKey: pulumi.String("IP"),
RateLimit: pulumi.Int(100),
Predicates: wafregional.RateBasedRulePredicateArray{
&wafregional.RateBasedRulePredicateArgs{
DataId: ipset.ID(),
Negated: pulumi.Bool(false),
Type: pulumi.String("IPMatch"),
},
},
}, pulumi.DependsOn([]pulumi.Resource{
ipset,
}))
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var ipset = new Aws.WafRegional.IpSet("ipset", new()
{
Name = "tfIPSet",
IpSetDescriptors = new[]
{
new Aws.WafRegional.Inputs.IpSetIpSetDescriptorArgs
{
Type = "IPV4",
Value = "192.0.7.0/24",
},
},
});
var wafrule = new Aws.WafRegional.RateBasedRule("wafrule", new()
{
Name = "tfWAFRule",
MetricName = "tfWAFRule",
RateKey = "IP",
RateLimit = 100,
Predicates = new[]
{
new Aws.WafRegional.Inputs.RateBasedRulePredicateArgs
{
DataId = ipset.Id,
Negated = false,
Type = "IPMatch",
},
},
}, new CustomResourceOptions
{
DependsOn =
{
ipset,
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.wafregional.IpSet;
import com.pulumi.aws.wafregional.IpSetArgs;
import com.pulumi.aws.wafregional.inputs.IpSetIpSetDescriptorArgs;
import com.pulumi.aws.wafregional.RateBasedRule;
import com.pulumi.aws.wafregional.RateBasedRuleArgs;
import com.pulumi.aws.wafregional.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()
.name("tfIPSet")
.ipSetDescriptors(IpSetIpSetDescriptorArgs.builder()
.type("IPV4")
.value("192.0.7.0/24")
.build())
.build());
var wafrule = new RateBasedRule("wafrule", RateBasedRuleArgs.builder()
.name("tfWAFRule")
.metricName("tfWAFRule")
.rateKey("IP")
.rateLimit(100)
.predicates(RateBasedRulePredicateArgs.builder()
.dataId(ipset.id())
.negated(false)
.type("IPMatch")
.build())
.build(), CustomResourceOptions.builder()
.dependsOn(ipset)
.build());
}
}
resources:
ipset:
type: aws:wafregional:IpSet
properties:
name: tfIPSet
ipSetDescriptors:
- type: IPV4
value: 192.0.7.0/24
wafrule:
type: aws:wafregional:RateBasedRule
properties:
name: tfWAFRule
metricName: tfWAFRule
rateKey: IP
rateLimit: 100
predicates:
- dataId: ${ipset.id}
negated: false
type: IPMatch
options:
dependson:
- ${ipset}
Create RateBasedRule Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new RateBasedRule(name: string, args: RateBasedRuleArgs, opts?: CustomResourceOptions);
@overload
def RateBasedRule(resource_name: str,
args: RateBasedRuleArgs,
opts: Optional[ResourceOptions] = None)
@overload
def RateBasedRule(resource_name: str,
opts: Optional[ResourceOptions] = None,
metric_name: Optional[str] = None,
rate_key: Optional[str] = None,
rate_limit: Optional[int] = None,
name: Optional[str] = None,
predicates: Optional[Sequence[RateBasedRulePredicateArgs]] = None,
tags: Optional[Mapping[str, str]] = 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:wafregional:RateBasedRule
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- 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.
Constructor example
The following reference example uses placeholder values for all input properties.
var awsRateBasedRuleResource = new Aws.WafRegional.RateBasedRule("awsRateBasedRuleResource", new()
{
MetricName = "string",
RateKey = "string",
RateLimit = 0,
Name = "string",
Predicates = new[]
{
new Aws.WafRegional.Inputs.RateBasedRulePredicateArgs
{
DataId = "string",
Negated = false,
Type = "string",
},
},
Tags =
{
{ "string", "string" },
},
});
example, err := wafregional.NewRateBasedRule(ctx, "awsRateBasedRuleResource", &wafregional.RateBasedRuleArgs{
MetricName: pulumi.String("string"),
RateKey: pulumi.String("string"),
RateLimit: pulumi.Int(0),
Name: pulumi.String("string"),
Predicates: wafregional.RateBasedRulePredicateArray{
&wafregional.RateBasedRulePredicateArgs{
DataId: pulumi.String("string"),
Negated: pulumi.Bool(false),
Type: pulumi.String("string"),
},
},
Tags: pulumi.StringMap{
"string": pulumi.String("string"),
},
})
var awsRateBasedRuleResource = new RateBasedRule("awsRateBasedRuleResource", RateBasedRuleArgs.builder()
.metricName("string")
.rateKey("string")
.rateLimit(0)
.name("string")
.predicates(RateBasedRulePredicateArgs.builder()
.dataId("string")
.negated(false)
.type("string")
.build())
.tags(Map.of("string", "string"))
.build());
aws_rate_based_rule_resource = aws.wafregional.RateBasedRule("awsRateBasedRuleResource",
metric_name="string",
rate_key="string",
rate_limit=0,
name="string",
predicates=[{
"dataId": "string",
"negated": False,
"type": "string",
}],
tags={
"string": "string",
})
const awsRateBasedRuleResource = new aws.wafregional.RateBasedRule("awsRateBasedRuleResource", {
metricName: "string",
rateKey: "string",
rateLimit: 0,
name: "string",
predicates: [{
dataId: "string",
negated: false,
type: "string",
}],
tags: {
string: "string",
},
});
type: aws:wafregional:RateBasedRule
properties:
metricName: string
name: string
predicates:
- dataId: string
negated: false
type: string
rateKey: string
rateLimit: 0
tags:
string: string
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:
- Metric
Name string - The name or description for the Amazon CloudWatch metric of this rule.
- Rate
Key string - 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 string
- The name or description of the rule.
- Predicates
List<Rate
Based Rule Predicate> - The objects to include in a rule (documented below).
- 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.
- Metric
Name string - The name or description for the Amazon CloudWatch metric of this rule.
- Rate
Key string - 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 string
- The name or description of the rule.
- Predicates
[]Rate
Based Rule Predicate Args - The objects to include in a rule (documented below).
- 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.
- metric
Name String - The name or description for the Amazon CloudWatch metric of this rule.
- rate
Key String - Valid value is IP.
- rate
Limit 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<Rate
Based Rule Predicate> - The objects to include in a rule (documented below).
- 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.
- metric
Name string - The name or description for the Amazon CloudWatch metric of this rule.
- rate
Key string - Valid value is IP.
- rate
Limit 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
Rate
Based Rule Predicate[] - The objects to include in a rule (documented below).
- {[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[Rate
Based Rule Predicate Args] - The objects to include in a rule (documented below).
- 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.
- metric
Name String - The name or description for the Amazon CloudWatch metric of this rule.
- rate
Key String - Valid value is IP.
- rate
Limit 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).
- 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:
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.
- Arn string
- The ARN of the WAF Regional Rate Based Rule.
- Metric
Name string - The name or description for the Amazon CloudWatch metric of this rule.
- Name string
- The name or description of the rule.
- Predicates
List<Rate
Based Rule Predicate> - The objects to include in a rule (documented below).
- Rate
Key string - 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.
- 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. - Dictionary<string, string>
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- Arn string
- The ARN of the WAF Regional Rate Based Rule.
- Metric
Name string - The name or description for the Amazon CloudWatch metric of this rule.
- Name string
- The name or description of the rule.
- Predicates
[]Rate
Based Rule Predicate Args - The objects to include in a rule (documented below).
- Rate
Key string - 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.
- 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. - map[string]string
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- arn String
- The ARN of the WAF Regional Rate Based Rule.
- metric
Name String - The name or description for the Amazon CloudWatch metric of this rule.
- name String
- The name or description of the rule.
- predicates
List<Rate
Based Rule Predicate> - The objects to include in a rule (documented below).
- rate
Key String - Valid value is IP.
- rate
Limit 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.
- 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. - Map<String,String>
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- arn string
- The ARN of the WAF Regional Rate Based Rule.
- metric
Name string - The name or description for the Amazon CloudWatch metric of this rule.
- name string
- The name or description of the rule.
- predicates
Rate
Based Rule Predicate[] - The objects to include in a rule (documented below).
- rate
Key string - Valid value is IP.
- rate
Limit 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.
- {[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. - {[key: string]: string}
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- arn str
- The ARN of the WAF Regional Rate Based Rule.
- 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[Rate
Based Rule Predicate Args] - 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.
- 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. - Mapping[str, str]
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- arn String
- The ARN of the WAF Regional Rate Based Rule.
- metric
Name 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).
- rate
Key String - Valid value is IP.
- rate
Limit 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.
- 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. - Map<String>
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
Supporting Types
RateBasedRulePredicate, RateBasedRulePredicateArgs
- Data
Id 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 specifiedByteMatchSet
,IPSet
,SqlInjectionMatchSet
,XssMatchSet
, orSizeConstraintSet
. For example, if an IPSet includes the IP address192.0.2.44
, AWS WAF will allow or block requests based on that IP address. If set totrue
, AWS WAF will allow, block, or count requests based on all IP addresses except192.0.2.44
. - Type string
- The type of predicate in a rule. Valid values:
ByteMatch
,GeoMatch
,IPMatch
,RegexMatch
,SizeConstraint
,SqlInjectionMatch
, orXssMatch
.
- Data
Id 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 specifiedByteMatchSet
,IPSet
,SqlInjectionMatchSet
,XssMatchSet
, orSizeConstraintSet
. For example, if an IPSet includes the IP address192.0.2.44
, AWS WAF will allow or block requests based on that IP address. If set totrue
, AWS WAF will allow, block, or count requests based on all IP addresses except192.0.2.44
. - Type string
- The type of predicate in a rule. Valid values:
ByteMatch
,GeoMatch
,IPMatch
,RegexMatch
,SizeConstraint
,SqlInjectionMatch
, orXssMatch
.
- data
Id 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 specifiedByteMatchSet
,IPSet
,SqlInjectionMatchSet
,XssMatchSet
, orSizeConstraintSet
. For example, if an IPSet includes the IP address192.0.2.44
, AWS WAF will allow or block requests based on that IP address. If set totrue
, AWS WAF will allow, block, or count requests based on all IP addresses except192.0.2.44
. - type String
- The type of predicate in a rule. Valid values:
ByteMatch
,GeoMatch
,IPMatch
,RegexMatch
,SizeConstraint
,SqlInjectionMatch
, orXssMatch
.
- data
Id 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 specifiedByteMatchSet
,IPSet
,SqlInjectionMatchSet
,XssMatchSet
, orSizeConstraintSet
. For example, if an IPSet includes the IP address192.0.2.44
, AWS WAF will allow or block requests based on that IP address. If set totrue
, AWS WAF will allow, block, or count requests based on all IP addresses except192.0.2.44
. - type string
- The type of predicate in a rule. Valid values:
ByteMatch
,GeoMatch
,IPMatch
,RegexMatch
,SizeConstraint
,SqlInjectionMatch
, orXssMatch
.
- 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 specifiedByteMatchSet
,IPSet
,SqlInjectionMatchSet
,XssMatchSet
, orSizeConstraintSet
. For example, if an IPSet includes the IP address192.0.2.44
, AWS WAF will allow or block requests based on that IP address. If set totrue
, AWS WAF will allow, block, or count requests based on all IP addresses except192.0.2.44
. - type str
- The type of predicate in a rule. Valid values:
ByteMatch
,GeoMatch
,IPMatch
,RegexMatch
,SizeConstraint
,SqlInjectionMatch
, orXssMatch
.
- data
Id 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 specifiedByteMatchSet
,IPSet
,SqlInjectionMatchSet
,XssMatchSet
, orSizeConstraintSet
. For example, if an IPSet includes the IP address192.0.2.44
, AWS WAF will allow or block requests based on that IP address. If set totrue
, AWS WAF will allow, block, or count requests based on all IP addresses except192.0.2.44
. - type String
- The type of predicate in a rule. Valid values:
ByteMatch
,GeoMatch
,IPMatch
,RegexMatch
,SizeConstraint
,SqlInjectionMatch
, orXssMatch
.
Import
Using pulumi import
, import WAF Regional Rate Based Rule using the id. For example:
$ pulumi import aws:wafregional/rateBasedRule:RateBasedRule wafrule a1b2c3d4-d5f6-7777-8888-9999aaaabbbbcccc
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
aws
Terraform Provider.