Skip to content
v2.277.0

Experimental

@aws-cdk/aws-route53resolver-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.

DnsBlockResponse Class ​

The way that you want DNS Firewall to block the request.

Example ​

ts
declare const myBlockList: route53resolver.FirewallDomainList;
declare const ruleGroup: route53resolver.FirewallRuleGroup;

ruleGroup.addRule({
  priority: 10,
  firewallDomainList: myBlockList,
  // block and reply with NXDOMAIN
  action: route53resolver.FirewallRuleAction.block(route53resolver.DnsBlockResponse.nxDomain()),
});

ruleGroup.addRule({
  priority: 20,
  firewallDomainList: myBlockList,
  // block and override DNS response with a custom domain
  action: route53resolver.FirewallRuleAction.block(route53resolver.DnsBlockResponse.override('amazon.com')),
});
python
# my_block_list: route53resolver.FirewallDomainList
# rule_group: route53resolver.FirewallRuleGroup


rule_group.add_rule(
    priority=10,
    firewall_domain_list=my_block_list,
    # block and reply with NXDOMAIN
    action=route53resolver.FirewallRuleAction.block(route53resolver.DnsBlockResponse.nx_domain())
)

rule_group.add_rule(
    priority=20,
    firewall_domain_list=my_block_list,
    # block and override DNS response with a custom domain
    action=route53resolver.FirewallRuleAction.block(route53resolver.DnsBlockResponse.override("amazon.com"))
)
java
FirewallDomainList myBlockList;
FirewallRuleGroup ruleGroup;


ruleGroup.addRule(FirewallRule.builder()
        .priority(10)
        .firewallDomainList(myBlockList)
        // block and reply with NXDOMAIN
        .action(FirewallRuleAction.block(DnsBlockResponse.nxDomain()))
        .build());

ruleGroup.addRule(FirewallRule.builder()
        .priority(20)
        .firewallDomainList(myBlockList)
        // block and override DNS response with a custom domain
        .action(FirewallRuleAction.block(DnsBlockResponse.override("amazon.com")))
        .build());
csharp
// Install: dotnet add package Amazon.CDK.AWS.Route53Resolver.Alpha
FirewallDomainList myBlockList;
FirewallRuleGroup ruleGroup;


ruleGroup.AddRule(new FirewallRule {
    Priority = 10,
    FirewallDomainList = myBlockList,
    // block and reply with NXDOMAIN
    Action = FirewallRuleAction.Block(DnsBlockResponse.NxDomain())
});

ruleGroup.AddRule(new FirewallRule {
    Priority = 20,
    FirewallDomainList = myBlockList,
    // block and override DNS response with a custom domain
    Action = FirewallRuleAction.Block(DnsBlockResponse.Override("amazon.com"))
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdkroute53resolveralpha/v2
var myBlockList FirewallDomainList
var ruleGroup FirewallRuleGroup


ruleGroup.AddRule(&FirewallRule{
	Priority: jsii.Number(10),
	FirewallDomainList: myBlockList,
	// block and reply with NXDOMAIN
	Action: route53resolver.FirewallRuleAction_Block(route53resolver.DnsBlockResponse_NxDomain()),
})

ruleGroup.AddRule(&FirewallRule{
	Priority: jsii.Number(20),
	FirewallDomainList: myBlockList,
	// block and override DNS response with a custom domain
	Action: route53resolver.FirewallRuleAction_*Block(route53resolver.DnsBlockResponse_Override(jsii.String("amazon.com"))),
})

Initializer ​

ts
new DnsBlockResponse()
python
DnsBlockResponse()
java
new DnsBlockResponse()
csharp
new DnsBlockResponse()
go
NewDnsBlockResponse()

Properties ​

blockOverrideDnsTypemay be undefinedstringblock_override_dns_typemay be undefinedstrblockOverrideDnsTypemay be undefinedStringBlockOverrideDnsTypemay be undefinedstringBlockOverrideDnsTypemay be undefined*string #
The DNS record's type.
blockOverrideDomainmay be undefinedstringblock_override_domainmay be undefinedstrblockOverrideDomainmay be undefinedStringBlockOverrideDomainmay be undefinedstringBlockOverrideDomainmay be undefined*string #
The custom DNS record to send back in response to the query.
blockOverrideTtlmay be undefinedDurationblock_override_ttlmay be undefinedDurationblockOverrideTtlmay be undefinedDurationBlockOverrideTtlmay be undefinedDurationBlockOverrideTtlmay be undefinedDuration #
The recommended amount of time for the DNS resolver or web browser to cache the provided override record.
blockResponsemay be undefinedstringblock_responsemay be undefinedstrblockResponsemay be undefinedStringBlockResponsemay be undefinedstringBlockResponsemay be undefined*string #
The way that you want DNS Firewall to block the request.

Methods ​

noData(): DnsBlockResponse // chainable@staticmethod def no_data() -> DnsBlockResponsepublic static DnsBlockResponse noData()public static DnsBlockResponse NoData()func NoData() DnsBlockResponse static #
Respond indicating that the query was successful, but no response is available for it.
nxDomain(): DnsBlockResponse // chainable@staticmethod def nx_domain() -> DnsBlockResponsepublic static DnsBlockResponse nxDomain()public static DnsBlockResponse NxDomain()func NxDomain() DnsBlockResponse static #
Respond indicating that the domain name that's in the query doesn't exist.
override(domain: string, ttl?: Duration): DnsBlockResponse // chainable@staticmethod def override(domain: str, ttl: typing.Optional[Duration] = None) -> DnsBlockResponsepublic static DnsBlockResponse override(String domain, Duration ttl)public static DnsBlockResponse Override(string domain, Duration? ttl = null)func Override(Domain *string, Ttl Duration) DnsBlockResponse static #
Provides a custom override response to the query.
2 parameters

Parameters

  • domaindomaindomaindomainDomain — The custom DNS record to send back in response to the query.
  • ttlttlttlttlTtl — The recommended amount of time for the DNS resolver or web browser to cache the provided override record.