How do I set up an AWS Route53 record?
To create an AWS Route53 record, you need to define a few resources. You will need to set up the Route53 hosted zone and the DNS record that you want to associate with it.
Detailed Explanation
Provider Configuration: This is where you specify that you are using AWS and set the region for your resources.
Hosted Zone: This represents a container that holds information about how you want to route traffic on the internet for a domain and its subdomains. In this example, we create a hosted zone for the specified domain.
Route53 Record: This represents a record that you want to create within the hosted zone. You specify the type of DNS record, such as A, CNAME, etc., and the value.
Program
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.route53.Zone("example", {name: "example.com"});
const exampleRecord = new aws.route53.Record("example_record", {
zoneId: example.zoneId,
name: "www.example.com",
type: aws.route53.RecordType.A,
ttl: 300,
records: ["1.2.3.4"],
});
export const zoneId = example.zoneId;
export const recordFqdn = exampleRecord.fqdn;
In this program, the AWS provider is configured with the region us-west-2
. A Route53 hosted zone for example.com
is created. Within this hosted zone, a DNS “A” record for www.example.com
is defined, which points to the IP address 1.2.3.4
. The outputs will provide the hosted zone ID and the fully qualified domain name of the record created.
Summary
To setup an AWS Route53 record, we configured the AWS provider, created a hosted zone, and defined a DNS record within that hosted zone. The outputs provide the necessary information about the created resources.
Deploy this code
Want to deploy this code? Sign up for a free Pulumi account to deploy in a few clicks.
Sign upNew to Pulumi?
Want to deploy this code? Sign up with Pulumi to deploy in a few clicks.
Sign upThank you for your feedback!
If you have a question about how to use Pulumi, reach out in Community Slack.
Open an issue on GitHub to report a problem or suggest an improvement.