1. Packages
  2. AWS
  3. API Docs
  4. waf
  5. ByteMatchSet
AWS v6.77.0 published on Wednesday, Apr 9, 2025 by Pulumi

aws.waf.ByteMatchSet

Explore with Pulumi AI

Provides a WAF Byte Match Set Resource

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const byteSet = new aws.waf.ByteMatchSet("byte_set", {
    name: "my_waf_byte_match_set",
    byteMatchTuples: [{
        textTransformation: "NONE",
        targetString: "badrefer1",
        positionalConstraint: "CONTAINS",
        fieldToMatch: {
            type: "HEADER",
            data: "referer",
        },
    }],
});
Copy
import pulumi
import pulumi_aws as aws

byte_set = aws.waf.ByteMatchSet("byte_set",
    name="my_waf_byte_match_set",
    byte_match_tuples=[{
        "text_transformation": "NONE",
        "target_string": "badrefer1",
        "positional_constraint": "CONTAINS",
        "field_to_match": {
            "type": "HEADER",
            "data": "referer",
        },
    }])
Copy
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 {
		_, err := waf.NewByteMatchSet(ctx, "byte_set", &waf.ByteMatchSetArgs{
			Name: pulumi.String("my_waf_byte_match_set"),
			ByteMatchTuples: waf.ByteMatchSetByteMatchTupleArray{
				&waf.ByteMatchSetByteMatchTupleArgs{
					TextTransformation:   pulumi.String("NONE"),
					TargetString:         pulumi.String("badrefer1"),
					PositionalConstraint: pulumi.String("CONTAINS"),
					FieldToMatch: &waf.ByteMatchSetByteMatchTupleFieldToMatchArgs{
						Type: pulumi.String("HEADER"),
						Data: pulumi.String("referer"),
					},
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var byteSet = new Aws.Waf.ByteMatchSet("byte_set", new()
    {
        Name = "my_waf_byte_match_set",
        ByteMatchTuples = new[]
        {
            new Aws.Waf.Inputs.ByteMatchSetByteMatchTupleArgs
            {
                TextTransformation = "NONE",
                TargetString = "badrefer1",
                PositionalConstraint = "CONTAINS",
                FieldToMatch = new Aws.Waf.Inputs.ByteMatchSetByteMatchTupleFieldToMatchArgs
                {
                    Type = "HEADER",
                    Data = "referer",
                },
            },
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.waf.ByteMatchSet;
import com.pulumi.aws.waf.ByteMatchSetArgs;
import com.pulumi.aws.waf.inputs.ByteMatchSetByteMatchTupleArgs;
import com.pulumi.aws.waf.inputs.ByteMatchSetByteMatchTupleFieldToMatchArgs;
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 byteSet = new ByteMatchSet("byteSet", ByteMatchSetArgs.builder()
            .name("my_waf_byte_match_set")
            .byteMatchTuples(ByteMatchSetByteMatchTupleArgs.builder()
                .textTransformation("NONE")
                .targetString("badrefer1")
                .positionalConstraint("CONTAINS")
                .fieldToMatch(ByteMatchSetByteMatchTupleFieldToMatchArgs.builder()
                    .type("HEADER")
                    .data("referer")
                    .build())
                .build())
            .build());

    }
}
Copy
resources:
  byteSet:
    type: aws:waf:ByteMatchSet
    name: byte_set
    properties:
      name: my_waf_byte_match_set
      byteMatchTuples:
        - textTransformation: NONE
          targetString: badrefer1
          positionalConstraint: CONTAINS
          fieldToMatch:
            type: HEADER
            data: referer
Copy

Create ByteMatchSet Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new ByteMatchSet(name: string, args?: ByteMatchSetArgs, opts?: CustomResourceOptions);
@overload
def ByteMatchSet(resource_name: str,
                 args: Optional[ByteMatchSetArgs] = None,
                 opts: Optional[ResourceOptions] = None)

@overload
def ByteMatchSet(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 byte_match_tuples: Optional[Sequence[ByteMatchSetByteMatchTupleArgs]] = None,
                 name: Optional[str] = None)
func NewByteMatchSet(ctx *Context, name string, args *ByteMatchSetArgs, opts ...ResourceOption) (*ByteMatchSet, error)
public ByteMatchSet(string name, ByteMatchSetArgs? args = null, CustomResourceOptions? opts = null)
public ByteMatchSet(String name, ByteMatchSetArgs args)
public ByteMatchSet(String name, ByteMatchSetArgs args, CustomResourceOptions options)
type: aws:waf:ByteMatchSet
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args ByteMatchSetArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args ByteMatchSetArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args ByteMatchSetArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args ByteMatchSetArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. ByteMatchSetArgs
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 byteMatchSetResource = new Aws.Waf.ByteMatchSet("byteMatchSetResource", new()
{
    ByteMatchTuples = new[]
    {
        new Aws.Waf.Inputs.ByteMatchSetByteMatchTupleArgs
        {
            FieldToMatch = new Aws.Waf.Inputs.ByteMatchSetByteMatchTupleFieldToMatchArgs
            {
                Type = "string",
                Data = "string",
            },
            PositionalConstraint = "string",
            TextTransformation = "string",
            TargetString = "string",
        },
    },
    Name = "string",
});
Copy
example, err := waf.NewByteMatchSet(ctx, "byteMatchSetResource", &waf.ByteMatchSetArgs{
	ByteMatchTuples: waf.ByteMatchSetByteMatchTupleArray{
		&waf.ByteMatchSetByteMatchTupleArgs{
			FieldToMatch: &waf.ByteMatchSetByteMatchTupleFieldToMatchArgs{
				Type: pulumi.String("string"),
				Data: pulumi.String("string"),
			},
			PositionalConstraint: pulumi.String("string"),
			TextTransformation:   pulumi.String("string"),
			TargetString:         pulumi.String("string"),
		},
	},
	Name: pulumi.String("string"),
})
Copy
var byteMatchSetResource = new ByteMatchSet("byteMatchSetResource", ByteMatchSetArgs.builder()
    .byteMatchTuples(ByteMatchSetByteMatchTupleArgs.builder()
        .fieldToMatch(ByteMatchSetByteMatchTupleFieldToMatchArgs.builder()
            .type("string")
            .data("string")
            .build())
        .positionalConstraint("string")
        .textTransformation("string")
        .targetString("string")
        .build())
    .name("string")
    .build());
Copy
byte_match_set_resource = aws.waf.ByteMatchSet("byteMatchSetResource",
    byte_match_tuples=[{
        "field_to_match": {
            "type": "string",
            "data": "string",
        },
        "positional_constraint": "string",
        "text_transformation": "string",
        "target_string": "string",
    }],
    name="string")
Copy
const byteMatchSetResource = new aws.waf.ByteMatchSet("byteMatchSetResource", {
    byteMatchTuples: [{
        fieldToMatch: {
            type: "string",
            data: "string",
        },
        positionalConstraint: "string",
        textTransformation: "string",
        targetString: "string",
    }],
    name: "string",
});
Copy
type: aws:waf:ByteMatchSet
properties:
    byteMatchTuples:
        - fieldToMatch:
            data: string
            type: string
          positionalConstraint: string
          targetString: string
          textTransformation: string
    name: string
Copy

ByteMatchSet Resource Properties

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

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The ByteMatchSet resource accepts the following input properties:

ByteMatchTuples List<ByteMatchSetByteMatchTuple>
Specifies the bytes (typically a string that corresponds with ASCII characters) that you want to search for in web requests, the location in requests that you want to search, and other settings.
Name Changes to this property will trigger replacement. string
The name or description of the Byte Match Set.
ByteMatchTuples []ByteMatchSetByteMatchTupleArgs
Specifies the bytes (typically a string that corresponds with ASCII characters) that you want to search for in web requests, the location in requests that you want to search, and other settings.
Name Changes to this property will trigger replacement. string
The name or description of the Byte Match Set.
byteMatchTuples List<ByteMatchSetByteMatchTuple>
Specifies the bytes (typically a string that corresponds with ASCII characters) that you want to search for in web requests, the location in requests that you want to search, and other settings.
name Changes to this property will trigger replacement. String
The name or description of the Byte Match Set.
byteMatchTuples ByteMatchSetByteMatchTuple[]
Specifies the bytes (typically a string that corresponds with ASCII characters) that you want to search for in web requests, the location in requests that you want to search, and other settings.
name Changes to this property will trigger replacement. string
The name or description of the Byte Match Set.
byte_match_tuples Sequence[ByteMatchSetByteMatchTupleArgs]
Specifies the bytes (typically a string that corresponds with ASCII characters) that you want to search for in web requests, the location in requests that you want to search, and other settings.
name Changes to this property will trigger replacement. str
The name or description of the Byte Match Set.
byteMatchTuples List<Property Map>
Specifies the bytes (typically a string that corresponds with ASCII characters) that you want to search for in web requests, the location in requests that you want to search, and other settings.
name Changes to this property will trigger replacement. String
The name or description of the Byte Match Set.

Outputs

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

Arn string
Amazon Resource Name (ARN) of the byte match set.
Id string
The provider-assigned unique ID for this managed resource.
Arn string
Amazon Resource Name (ARN) of the byte match set.
Id string
The provider-assigned unique ID for this managed resource.
arn String
Amazon Resource Name (ARN) of the byte match set.
id String
The provider-assigned unique ID for this managed resource.
arn string
Amazon Resource Name (ARN) of the byte match set.
id string
The provider-assigned unique ID for this managed resource.
arn str
Amazon Resource Name (ARN) of the byte match set.
id str
The provider-assigned unique ID for this managed resource.
arn String
Amazon Resource Name (ARN) of the byte match set.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing ByteMatchSet Resource

Get an existing ByteMatchSet 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?: ByteMatchSetState, opts?: CustomResourceOptions): ByteMatchSet
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        arn: Optional[str] = None,
        byte_match_tuples: Optional[Sequence[ByteMatchSetByteMatchTupleArgs]] = None,
        name: Optional[str] = None) -> ByteMatchSet
func GetByteMatchSet(ctx *Context, name string, id IDInput, state *ByteMatchSetState, opts ...ResourceOption) (*ByteMatchSet, error)
public static ByteMatchSet Get(string name, Input<string> id, ByteMatchSetState? state, CustomResourceOptions? opts = null)
public static ByteMatchSet get(String name, Output<String> id, ByteMatchSetState state, CustomResourceOptions options)
resources:  _:    type: aws:waf:ByteMatchSet    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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) of the byte match set.
ByteMatchTuples List<ByteMatchSetByteMatchTuple>
Specifies the bytes (typically a string that corresponds with ASCII characters) that you want to search for in web requests, the location in requests that you want to search, and other settings.
Name Changes to this property will trigger replacement. string
The name or description of the Byte Match Set.
Arn string
Amazon Resource Name (ARN) of the byte match set.
ByteMatchTuples []ByteMatchSetByteMatchTupleArgs
Specifies the bytes (typically a string that corresponds with ASCII characters) that you want to search for in web requests, the location in requests that you want to search, and other settings.
Name Changes to this property will trigger replacement. string
The name or description of the Byte Match Set.
arn String
Amazon Resource Name (ARN) of the byte match set.
byteMatchTuples List<ByteMatchSetByteMatchTuple>
Specifies the bytes (typically a string that corresponds with ASCII characters) that you want to search for in web requests, the location in requests that you want to search, and other settings.
name Changes to this property will trigger replacement. String
The name or description of the Byte Match Set.
arn string
Amazon Resource Name (ARN) of the byte match set.
byteMatchTuples ByteMatchSetByteMatchTuple[]
Specifies the bytes (typically a string that corresponds with ASCII characters) that you want to search for in web requests, the location in requests that you want to search, and other settings.
name Changes to this property will trigger replacement. string
The name or description of the Byte Match Set.
arn str
Amazon Resource Name (ARN) of the byte match set.
byte_match_tuples Sequence[ByteMatchSetByteMatchTupleArgs]
Specifies the bytes (typically a string that corresponds with ASCII characters) that you want to search for in web requests, the location in requests that you want to search, and other settings.
name Changes to this property will trigger replacement. str
The name or description of the Byte Match Set.
arn String
Amazon Resource Name (ARN) of the byte match set.
byteMatchTuples List<Property Map>
Specifies the bytes (typically a string that corresponds with ASCII characters) that you want to search for in web requests, the location in requests that you want to search, and other settings.
name Changes to this property will trigger replacement. String
The name or description of the Byte Match Set.

Supporting Types

ByteMatchSetByteMatchTuple
, ByteMatchSetByteMatchTupleArgs

FieldToMatch This property is required. ByteMatchSetByteMatchTupleFieldToMatch
The part of a web request that you want to search, such as a specified header or a query string.
PositionalConstraint This property is required. string
Within the portion of a web request that you want to search (for example, in the query string, if any), specify where you want to search. e.g., CONTAINS, CONTAINS_WORD or EXACTLY. See docs for all supported values.
TextTransformation This property is required. string
Text transformations used to eliminate unusual formatting that attackers use in web requests in an effort to bypass AWS WAF. If you specify a transformation, AWS WAF performs the transformation on target_string before inspecting a request for a match. e.g., CMD_LINE, HTML_ENTITY_DECODE or NONE. See docs for all supported values.
TargetString string
The value that you want to search for within the field specified by field_to_match, e.g., badrefer1. See docs for all supported values.
FieldToMatch This property is required. ByteMatchSetByteMatchTupleFieldToMatch
The part of a web request that you want to search, such as a specified header or a query string.
PositionalConstraint This property is required. string
Within the portion of a web request that you want to search (for example, in the query string, if any), specify where you want to search. e.g., CONTAINS, CONTAINS_WORD or EXACTLY. See docs for all supported values.
TextTransformation This property is required. string
Text transformations used to eliminate unusual formatting that attackers use in web requests in an effort to bypass AWS WAF. If you specify a transformation, AWS WAF performs the transformation on target_string before inspecting a request for a match. e.g., CMD_LINE, HTML_ENTITY_DECODE or NONE. See docs for all supported values.
TargetString string
The value that you want to search for within the field specified by field_to_match, e.g., badrefer1. See docs for all supported values.
fieldToMatch This property is required. ByteMatchSetByteMatchTupleFieldToMatch
The part of a web request that you want to search, such as a specified header or a query string.
positionalConstraint This property is required. String
Within the portion of a web request that you want to search (for example, in the query string, if any), specify where you want to search. e.g., CONTAINS, CONTAINS_WORD or EXACTLY. See docs for all supported values.
textTransformation This property is required. String
Text transformations used to eliminate unusual formatting that attackers use in web requests in an effort to bypass AWS WAF. If you specify a transformation, AWS WAF performs the transformation on target_string before inspecting a request for a match. e.g., CMD_LINE, HTML_ENTITY_DECODE or NONE. See docs for all supported values.
targetString String
The value that you want to search for within the field specified by field_to_match, e.g., badrefer1. See docs for all supported values.
fieldToMatch This property is required. ByteMatchSetByteMatchTupleFieldToMatch
The part of a web request that you want to search, such as a specified header or a query string.
positionalConstraint This property is required. string
Within the portion of a web request that you want to search (for example, in the query string, if any), specify where you want to search. e.g., CONTAINS, CONTAINS_WORD or EXACTLY. See docs for all supported values.
textTransformation This property is required. string
Text transformations used to eliminate unusual formatting that attackers use in web requests in an effort to bypass AWS WAF. If you specify a transformation, AWS WAF performs the transformation on target_string before inspecting a request for a match. e.g., CMD_LINE, HTML_ENTITY_DECODE or NONE. See docs for all supported values.
targetString string
The value that you want to search for within the field specified by field_to_match, e.g., badrefer1. See docs for all supported values.
field_to_match This property is required. ByteMatchSetByteMatchTupleFieldToMatch
The part of a web request that you want to search, such as a specified header or a query string.
positional_constraint This property is required. str
Within the portion of a web request that you want to search (for example, in the query string, if any), specify where you want to search. e.g., CONTAINS, CONTAINS_WORD or EXACTLY. See docs for all supported values.
text_transformation This property is required. str
Text transformations used to eliminate unusual formatting that attackers use in web requests in an effort to bypass AWS WAF. If you specify a transformation, AWS WAF performs the transformation on target_string before inspecting a request for a match. e.g., CMD_LINE, HTML_ENTITY_DECODE or NONE. See docs for all supported values.
target_string str
The value that you want to search for within the field specified by field_to_match, e.g., badrefer1. See docs for all supported values.
fieldToMatch This property is required. Property Map
The part of a web request that you want to search, such as a specified header or a query string.
positionalConstraint This property is required. String
Within the portion of a web request that you want to search (for example, in the query string, if any), specify where you want to search. e.g., CONTAINS, CONTAINS_WORD or EXACTLY. See docs for all supported values.
textTransformation This property is required. String
Text transformations used to eliminate unusual formatting that attackers use in web requests in an effort to bypass AWS WAF. If you specify a transformation, AWS WAF performs the transformation on target_string before inspecting a request for a match. e.g., CMD_LINE, HTML_ENTITY_DECODE or NONE. See docs for all supported values.
targetString String
The value that you want to search for within the field specified by field_to_match, e.g., badrefer1. See docs for all supported values.

ByteMatchSetByteMatchTupleFieldToMatch
, ByteMatchSetByteMatchTupleFieldToMatchArgs

Type This property is required. string
The part of the web request that you want AWS WAF to search for a specified string. e.g., HEADER, METHOD or BODY. See docs for all supported values.
Data string
When type is HEADER, enter the name of the header that you want to search, e.g., User-Agent or Referer. If type is any other value, omit this field.
Type This property is required. string
The part of the web request that you want AWS WAF to search for a specified string. e.g., HEADER, METHOD or BODY. See docs for all supported values.
Data string
When type is HEADER, enter the name of the header that you want to search, e.g., User-Agent or Referer. If type is any other value, omit this field.
type This property is required. String
The part of the web request that you want AWS WAF to search for a specified string. e.g., HEADER, METHOD or BODY. See docs for all supported values.
data String
When type is HEADER, enter the name of the header that you want to search, e.g., User-Agent or Referer. If type is any other value, omit this field.
type This property is required. string
The part of the web request that you want AWS WAF to search for a specified string. e.g., HEADER, METHOD or BODY. See docs for all supported values.
data string
When type is HEADER, enter the name of the header that you want to search, e.g., User-Agent or Referer. If type is any other value, omit this field.
type This property is required. str
The part of the web request that you want AWS WAF to search for a specified string. e.g., HEADER, METHOD or BODY. See docs for all supported values.
data str
When type is HEADER, enter the name of the header that you want to search, e.g., User-Agent or Referer. If type is any other value, omit this field.
type This property is required. String
The part of the web request that you want AWS WAF to search for a specified string. e.g., HEADER, METHOD or BODY. See docs for all supported values.
data String
When type is HEADER, enter the name of the header that you want to search, e.g., User-Agent or Referer. If type is any other value, omit this field.

Import

Using pulumi import, import WAF Byte Match Set using the id. For example:

$ pulumi import aws:waf/byteMatchSet:ByteMatchSet byte_set a1b2c3d4-d5f6-7777-8888-9999aaaabbbbcccc
Copy

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.