Skip to content

AWS.Route53Resolver reference

Source: src/AWS/Route53Resolver/GetResolverEndpoint.ts

Runtime binding for route53resolver:GetResolverEndpoint — read the bound ResolverEndpoint’s live state (status, IP address count, host VPC, protocols); the endpoint ID is injected automatically.

Provide Route53Resolver.GetResolverEndpointHttp on the hosting Lambda Function to satisfy the requirement.

GetResolverEndpoint: Reading Endpoint State

Section titled “GetResolverEndpoint: Reading Endpoint State”
// init — grants route53resolver:GetResolverEndpoint on the endpoint
const getEndpoint = yield* AWS.Route53Resolver.GetResolverEndpoint(endpoint);
// runtime
const { ResolverEndpoint } = yield* getEndpoint();
console.log(ResolverEndpoint?.Status, ResolverEndpoint?.IpAddressCount);

Source: src/AWS/Route53Resolver/GetResolverRule.ts

Runtime binding for route53resolver:GetResolverRule — read the bound ResolverRule’s live state (domain name, target IPs, endpoint, status); the rule ID is injected automatically.

Provide Route53Resolver.GetResolverRuleHttp on the hosting Lambda Function to satisfy the requirement.

// init — grants route53resolver:GetResolverRule on the rule
const getRule = yield* AWS.Route53Resolver.GetResolverRule(rule);
// runtime
const { ResolverRule } = yield* getRule();
const targets = (ResolverRule?.TargetIps ?? []).map((t) => t.Ip);

Source: src/AWS/Route53Resolver/ListResolverEndpointIpAddresses.ts

Runtime binding for route53resolver:ListResolverEndpointIpAddresses — discover the IP addresses the bound ResolverEndpoint’s network interfaces answer/forward on (one per subnet); the endpoint ID is injected automatically.

The canonical runtime use: DNS bootstrap automation that reads an INBOUND endpoint’s IPs to configure on-premises conditional forwarders (or a VPN / DHCP option set) without hard-coding addresses.

Provide Route53Resolver.ListResolverEndpointIpAddressesHttp on the hosting Lambda Function to satisfy the requirement.

ListResolverEndpointIpAddresses: Discovering Endpoint IPs

Section titled “ListResolverEndpointIpAddresses: Discovering Endpoint IPs”
// init — grants route53resolver:ListResolverEndpointIpAddresses on the endpoint
const listIps = yield* AWS.Route53Resolver.ListResolverEndpointIpAddresses(endpoint);
// runtime
const { IpAddresses } = yield* listIps();
const ips = (IpAddresses ?? []).map((ip) => ip.Ip);

Source: src/AWS/Route53Resolver/ListResolverRuleAssociations.ts

Runtime binding for route53resolver:ListResolverRuleAssociations — enumerate the VPC associations of the bound ResolverRule. The request is automatically filtered to the bound rule (Filters: [{ Name: "ResolverRuleId", … }]).

Provide Route53Resolver.ListResolverRuleAssociationsHttp on the hosting Lambda Function to satisfy the requirement.

ListResolverRuleAssociations: Reading Rule State

Section titled “ListResolverRuleAssociations: Reading Rule State”
// init — grants route53resolver:ListResolverRuleAssociations on the rule
const listAssociations = yield* AWS.Route53Resolver.ListResolverRuleAssociations(rule);
// runtime
const { ResolverRuleAssociations } = yield* listAssociations();
const vpcIds = (ResolverRuleAssociations ?? []).map((a) => a.VPCId);

Source: src/AWS/Route53Resolver/ResolverEndpoint.ts

A Route 53 Resolver endpoint — the set of elastic network interfaces that connect your VPC’s .2 resolver to DNS resolvers on your own network.

An INBOUND endpoint lets DNS resolvers on your network forward queries to Route 53 Resolver; an OUTBOUND endpoint lets Resolver forward queries from your VPCs to your network (paired with FORWARD ResolverRules).

Endpoint provisioning is asynchronous (typically 1-2 minutes); the provider waits (bounded) for the endpoint to become OPERATIONAL so dependent resolver rules can use it immediately.

Inbound Endpoint

import * as Route53Resolver from "alchemy/AWS/Route53Resolver";
const inbound = yield* Route53Resolver.ResolverEndpoint("Inbound", {
direction: "INBOUND",
securityGroupIds: [sg.securityGroupId],
ipAddresses: [
{ subnetId: subnetA.subnetId },
{ subnetId: subnetB.subnetId },
],
});

Outbound Endpoint with Fixed IPs

const outbound = yield* Route53Resolver.ResolverEndpoint("Outbound", {
direction: "OUTBOUND",
securityGroupIds: [sg.securityGroupId],
ipAddresses: [
{ subnetId: subnetA.subnetId, ip: "10.0.0.10" },
{ subnetId: subnetB.subnetId, ip: "10.0.1.10" },
],
});
const rule = yield* Route53Resolver.ResolverRule("CorpForward", {
domainName: "corp.example.com",
resolverEndpointId: outbound.resolverEndpointId,
targetIps: [{ ip: "192.168.1.10" }],
});

Source: src/AWS/Route53Resolver/ResolverRule.ts

A Route 53 Resolver rule — tells Resolver how to handle DNS queries for a domain that originate in your VPCs.

A FORWARD rule sends matching queries through an OUTBOUND ResolverEndpoint to the DNS resolvers on your network listed in targetIps. The rule takes effect in a VPC once attached with a ResolverRuleAssociation.

import * as Route53Resolver from "alchemy/AWS/Route53Resolver";
const rule = yield* Route53Resolver.ResolverRule("CorpForward", {
domainName: "corp.example.com",
resolverEndpointId: outbound.resolverEndpointId,
targetIps: [{ ip: "192.168.1.10" }, { ip: "192.168.1.11", port: 53 }],
});
const association = yield* Route53Resolver.ResolverRuleAssociation(
"CorpForwardAssoc",
{
resolverRuleId: rule.resolverRuleId,
vpcId: vpc.vpcId,
},
);

Source: src/AWS/Route53Resolver/ResolverRuleAssociation.ts

An association between a Route 53 Resolver rule and a VPC. Once associated, Resolver applies the rule to DNS queries that originate in that VPC.

ResolverRuleAssociation: Associating Rules

Section titled “ResolverRuleAssociation: Associating Rules”
import * as Route53Resolver from "alchemy/AWS/Route53Resolver";
const association = yield* Route53Resolver.ResolverRuleAssociation(
"CorpForwardAssoc",
{
resolverRuleId: rule.resolverRuleId,
vpcId: vpc.vpcId,
},
);

Source: src/AWS/Route53Resolver/UpdateResolverRule.ts

Runtime binding for route53resolver:UpdateResolverRule — update the bound ResolverRule’s mutable configuration (name, target IPs, outbound endpoint); the rule ID is injected automatically.

The canonical runtime use: DNS failover automation — a Lambda health-checks the on-premises resolvers a FORWARD rule targets and swaps TargetIps to the healthy set when one goes dark.

Provide Route53Resolver.UpdateResolverRuleHttp on the hosting Lambda Function to satisfy the requirement.

UpdateResolverRule: Updating Rules at Runtime

Section titled “UpdateResolverRule: Updating Rules at Runtime”
// init — grants route53resolver:UpdateResolverRule on the rule
const updateRule = yield* AWS.Route53Resolver.UpdateResolverRule(rule);
// runtime
yield* updateRule({
Config: { TargetIps: [{ Ip: "192.168.2.10", Port: 53 }] },
});