# CfnResolverRuleProps

Properties for defining a `CfnResolverRule`.

Used as props by: [CfnResolverRule](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_route53resolver.CfnResolverRule.html)

- Source: Generated at build time
- Type last changed: v2.203.0 · 1 Jul 2025

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_route53resolver as route53resolver } from 'aws-cdk-lib';
const cfnResolverRuleProps: route53resolver.CfnResolverRuleProps = {
  ruleType: 'ruleType',

  // the properties below are optional
  delegationRecord: 'delegationRecord',
  domainName: 'domainName',
  name: 'name',
  resolverEndpointId: 'resolverEndpointId',
  tags: [{
    key: 'key',
    value: 'value',
  }],
  targetIps: [{
    ip: 'ip',
    ipv6: 'ipv6',
    port: 'port',
    protocol: 'protocol',
    serverNameIndication: 'serverNameIndication',
  }],
};
```

Python:

```python
from aws_cdk import CfnTag
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_route53resolver as route53resolver

cfn_resolver_rule_props = route53resolver.CfnResolverRuleProps(
    rule_type="ruleType",

    # the properties below are optional
    delegation_record="delegationRecord",
    domain_name="domainName",
    name="name",
    resolver_endpoint_id="resolverEndpointId",
    tags=[CfnTag(
        key="key",
        value="value"
    )],
    target_ips=[route53resolver.CfnResolverRule.TargetAddressProperty(
        ip="ip",
        ipv6="ipv6",
        port="port",
        protocol="protocol",
        server_name_indication="serverNameIndication"
    )]
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.route53resolver.*;

CfnResolverRuleProps cfnResolverRuleProps = CfnResolverRuleProps.builder()
        .ruleType("ruleType")

        // the properties below are optional
        .delegationRecord("delegationRecord")
        .domainName("domainName")
        .name("name")
        .resolverEndpointId("resolverEndpointId")
        .tags(List.of(CfnTag.builder()
                .key("key")
                .value("value")
                .build()))
        .targetIps(List.of(TargetAddressProperty.builder()
                .ip("ip")
                .ipv6("ipv6")
                .port("port")
                .protocol("protocol")
                .serverNameIndication("serverNameIndication")
                .build()))
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Route53Resolver;

var cfnResolverRuleProps = new CfnResolverRuleProps {
    RuleType = "ruleType",

    // the properties below are optional
    DelegationRecord = "delegationRecord",
    DomainName = "domainName",
    Name = "name",
    ResolverEndpointId = "resolverEndpointId",
    Tags = new [] { new CfnTag {
        Key = "key",
        Value = "value"
    } },
    TargetIps = new [] { new TargetAddressProperty {
        Ip = "ip",
        Ipv6 = "ipv6",
        Port = "port",
        Protocol = "protocol",
        ServerNameIndication = "serverNameIndication"
    } }
};
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

cfnResolverRuleProps := &CfnResolverRuleProps{
	RuleType: jsii.String("ruleType"),

	// the properties below are optional
	DelegationRecord: jsii.String("delegationRecord"),
	DomainName: jsii.String("domainName"),
	Name: jsii.String("name"),
	ResolverEndpointId: jsii.String("resolverEndpointId"),
	Tags: []CfnTag{
		&CfnTag{
			Key: jsii.String("key"),
			Value: jsii.String("value"),
		},
	},
	TargetIps: []interface{}{
		&TargetAddressProperty{
			Ip: jsii.String("ip"),
			Ipv6: jsii.String("ipv6"),
			Port: jsii.String("port"),
			Protocol: jsii.String("protocol"),
			ServerNameIndication: jsii.String("serverNameIndication"),
		},
	},
}
```

## Properties

- `delegationRecord`: string — DNS queries with delegation records that point to this domain name are forwarded to resolvers on your network.

- `domainName`: string — DNS queries for this domain name are forwarded to the IP addresses that are specified in `TargetIps` .

  If a query matches multiple Resolver rules (example.com and www.example.com), the query is routed using the Resolver rule that contains the most specific domain name (www.example.com).

- `name`: string — The name for the Resolver rule, which you specified when you created the Resolver rule.

  The name can be up to 64 characters long and can contain letters (a-z, A-Z), numbers (0-9), hyphens (-), underscores (_), and spaces. The name cannot consist of only numbers.

- `resolverEndpointId`: string — The ID of the endpoint that the rule is associated with.

- `ruleType`: string (required) — When you want to forward DNS queries for specified domain name to resolvers on your network, specify `FORWARD` or `DELEGATE` .

  If a query matches multiple Resolver rules (example.com and www.example.com), outbound DNS queries are routed using the Resolver rule that contains the most specific domain name (www.example.com).

  When you have a forwarding rule to forward DNS queries for a domain to your network and you want Resolver to process queries for a subdomain of that domain, specify `SYSTEM` .

  For example, to forward DNS queries for example.com to resolvers on your network, you create a rule and specify `FORWARD` for `RuleType` . To then have Resolver process queries for apex.example.com, you create a rule and specify `SYSTEM` for `RuleType` .

  Currently, only Resolver can create rules that have a value of `RECURSIVE` for `RuleType` .

- `tags`: [CfnTag](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.CfnTag.html)[] — Tags help organize and categorize your Resolver rules.

  Each tag consists of a key and an optional value, both of which you define.

- `targetIps`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnResolverRule.TargetAddressProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_route53resolver.CfnResolverRule.TargetAddressProperty.html)[] — An array that contains the IP addresses and ports that an outbound endpoint forwards DNS queries to.

  Typically, these are the IP addresses of DNS resolvers on your network.
