Skip to main content

Record

Provides a single Route53 Record

Examples#

A Record#

Add an A record to the hosted zone:

const domainName = "your.domain.name.com";
const domain = provider.Route53Domain.useDomain({
name: domainName,
});
const hostedZoneName = `${domainName}.`;
const hostedZone = provider.Route53.makeHostedZone({
name: hostedZoneName,
dependencies: () => ({ domain }),
});
const recordA = provider.Route53.makeRecord({
name: `${hostedZoneName}-ipv4`,
dependencies: () => ({ hostedZone, eip }),
properties: ({ dependencies: { eip } }) => {
return {
Name: hostedZoneName,
Type: "A",
ResourceRecords: [
{
Value: eip.live?.PublicIp,
},
],
TTL: 60,
};
},
});

CNAME from a certificate#

Verify a certificate with DNS validation by adding a CNAME record.

const domainName = "your.domain.name.com";
const domain = provider.Route53Domain.useDomain({
name: domainName,
});
const hostedZoneName = `${domainName}.`;
const hostedZone = provider.Route53.makeHostedZone({
name: hostedZoneName,
dependencies: () => ({ domain }),
});
const recordValidation = provider.Route53.makeRecord({
dependencies: () => ({ hostedZone, certificate }),
});

Alias for CloudFront Distribution#

Add an alias entry to the the CloudFront distribution domain name

const domainName = "your.domain.name.com";
const distribution = provider.CloudFront.makeDistribution({
name: `distribution-${bucketName}`,
dependencies: () => ({ websiteBucket, certificate }),
properties: ({}) => {
// More stuff here
},
});
const hostedZone = provider.Route53.makeHostedZone({
name: `${domainName}.`,
dependencies: () => ({ domain }),
});
const recordCloudFront = provider.Route53.makeRecord({
dependencies: () => ({ hostedZone, distribution }),
});

Source Code Examples#

Properties#

Dependencies#

List#

┌────────────────────────────────────────────────────────────────────────────┐
│ 3 route53::Record from aws │
├────────────────────┬────────────────────────────────────────────────┬──────┤
│ Name │ Data │ Our │
├────────────────────┼────────────────────────────────────────────────┼──────┤
│ grucloud.org.::NS │ Name: grucloud.org. │ Yes │
│ │ Type: NS │ │
│ │ TTL: 172800 │ │
│ │ ResourceRecords: │ │
│ │ - Value: ns-1907.awsdns-46.co.uk. │ │
│ │ - Value: ns-15.awsdns-01.com. │ │
│ │ - Value: ns-1423.awsdns-49.org. │ │
│ │ - Value: ns-514.awsdns-00.net. │ │
│ │ HostedZoneId: /hostedzone/Z0064831PNCGMBFQ0H7Y │ │
│ │ │ │
├────────────────────┼────────────────────────────────────────────────┼──────┤
│ grucloud.org.::SOA │ Name: grucloud.org. │ Yes │
│ │ Type: SOA │ │
│ │ TTL: 900 │ │
│ │ ResourceRecords: │ │
│ │ - Value: ns-1907.awsdns-46.co.uk. awsdns-ho… │ │
│ │ HostedZoneId: /hostedzone/Z0064831PNCGMBFQ0H7Y │ │
│ │ │ │
├────────────────────┼────────────────────────────────────────────────┼──────┤
│ txt.grucloud.org. │ Name: grucloud.org. │ Yes │
│ │ Type: TXT │ │
│ │ TTL: 60 │ │
│ │ ResourceRecords: │ │
│ │ - Value: "google-site-verification=q_tZuuK8… │ │
│ │ Tags: │ │
│ │ - Key: gc-managed-by │ │
│ │ Value: grucloud │ │
│ │ - Key: gc-project-name │ │
│ │ Value: @grucloud/example-aws-route53-dns-… │ │
│ │ - Key: gc-stage │ │
│ │ Value: dev │ │
│ │ - Key: gc-record-txt.grucloud.org. │ │
│ │ Value: grucloud.org.::TXT │ │
│ │ - Key: gc-created-by-provider │ │
│ │ Value: aws │ │
│ │ - Key: Name │ │
│ │ Value: grucloud.org. │ │
│ │ HostedZoneId: /hostedzone/Z0064831PNCGMBFQ0H7Y │ │
│ │ namespace: │ │
│ │ │ │
└────────────────────┴────────────────────────────────────────────────┴──────┘