Experimental
@aws-cdk/aws-route53resolver-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.
FirewallRule Struct
A Firewall Rule.
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"))),
})
Properties
actionFirewallRuleActionactionFirewallRuleActionactionFirewallRuleActionActionFirewallRuleActionActionFirewallRuleActionrequired#The action for this rule.
firewallDomainListIFirewallDomainListfirewall_domain_listIFirewallDomainListfirewallDomainListIFirewallDomainListFirewallDomainListIFirewallDomainListFirewallDomainListIFirewallDomainListrequired#The domain list for this rule.
The priority of the rule in the rule group.
This value must be unique within the rule group.