Zone class
Manages a Route53 Hosted Zone. For managing DNS Security Extensions (DNSSEC), see the aws.route53.KeySigningKey and aws.route53.HostedZoneDnsSec resources.
Example Usage
Public Zone
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const primary = new aws.route53.Zone("primary", {name: "example.com"});
import pulumi
import pulumi_aws as aws
primary = aws.route53.Zone("primary", name="example.com")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var primary = new Aws.Route53.Zone("primary", new()
{
Name = "example.com",
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/route53"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := route53.NewZone(ctx, "primary", &route53.ZoneArgs{
Name: pulumi.String("example.com"),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_route53_zone" "primary" {
name = "example.com"
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.route53.Zone;
import com.pulumi.aws.route53.ZoneArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var primary = new Zone("primary", ZoneArgs.builder()
.name("example.com")
.build());
}
}
resources:
primary:
type: aws:route53:Zone
properties:
name: example.com
Public Subdomain Zone
For use in subdomains, note that you need to create a
aws.route53.Record of type NS as well as the subdomain
zone.
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const main = new aws.route53.Zone("main", {name: "example.com"});
const dev = new aws.route53.Zone("dev", {
name: "dev.example.com",
tags: {
Environment: "dev",
},
});
const dev_ns = new aws.route53.Record("dev-ns", {
zoneId: main.zoneId,
name: "dev.example.com",
type: aws.route53.RecordType.NS,
ttl: 30,
records: dev.nameServers,
});
import pulumi
import pulumi_aws as aws
main = aws.route53.Zone("main", name="example.com")
dev = aws.route53.Zone("dev",
name="dev.example.com",
tags={
"Environment": "dev",
})
dev_ns = aws.route53.Record("dev-ns",
zone_id=main.zone_id,
name="dev.example.com",
type=aws.route53.RecordType.NS,
ttl=30,
records=dev.name_servers)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var main = new Aws.Route53.Zone("main", new()
{
Name = "example.com",
});
var dev = new Aws.Route53.Zone("dev", new()
{
Name = "dev.example.com",
Tags =
{
{ "Environment", "dev" },
},
});
var dev_ns = new Aws.Route53.Record("dev-ns", new()
{
ZoneId = main.ZoneId,
Name = "dev.example.com",
Type = Aws.Route53.RecordType.NS,
Ttl = 30,
Records = dev.NameServers,
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/route53"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
main, err := route53.NewZone(ctx, "main", &route53.ZoneArgs{
Name: pulumi.String("example.com"),
})
if err != nil {
return err
}
dev, err := route53.NewZone(ctx, "dev", &route53.ZoneArgs{
Name: pulumi.String("dev.example.com"),
Tags: pulumi.StringMap{
"Environment": pulumi.String("dev"),
},
})
if err != nil {
return err
}
_, err = route53.NewRecord(ctx, "dev-ns", &route53.RecordArgs{
ZoneId: main.ZoneId,
Name: pulumi.String("dev.example.com"),
Type: pulumi.String(route53.RecordTypeNS),
Ttl: pulumi.Int(30),
Records: dev.NameServers,
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_route53_zone" "main" {
name = "example.com"
}
resource "aws_route53_zone" "dev" {
name = "dev.example.com"
tags = {
"Environment" = "dev"
}
}
resource "aws_route53_record" "dev-ns" {
zone_id = aws_route53_zone.main.zone_id
name = "dev.example.com"
type = "NS"
ttl = "30"
records = aws_route53_zone.dev.name_servers
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.route53.Zone;
import com.pulumi.aws.route53.ZoneArgs;
import com.pulumi.aws.route53.Record;
import com.pulumi.aws.route53.RecordArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var main = new Zone("main", ZoneArgs.builder()
.name("example.com")
.build());
var dev = new Zone("dev", ZoneArgs.builder()
.name("dev.example.com")
.tags(Map.of("Environment", "dev"))
.build());
var dev_ns = new Record("dev-ns", RecordArgs.builder()
.zoneId(main.zoneId())
.name("dev.example.com")
.type("NS")
.ttl(30)
.records(dev.nameServers())
.build());
}
}
resources:
main:
type: aws:route53:Zone
properties:
name: example.com
dev:
type: aws:route53:Zone
properties:
name: dev.example.com
tags:
Environment: dev
dev-ns:
type: aws:route53:Record
properties:
zoneId: ${main.zoneId}
name: dev.example.com
type: NS
ttl: '30'
records: ${dev.nameServers}
Private Zone
> NOTE: This provider provides both exclusive VPC associations defined in-line in this resource via vpc configuration blocks and a separate Zone VPC Association resource. At this time, you cannot use in-line VPC associations in conjunction with any aws.route53.ZoneAssociation resources with the same zone ID otherwise it will cause a perpetual difference in plan output. You can optionally use [ignoreChanges](https://www.pulumi.com/docs/intro/concepts/programming-model/#ignorechanges) to manage additional associations via the aws.route53.ZoneAssociation` resource.
> NOTE: Private zones require at least one VPC association at all times.
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const primary = new aws.ec2.Vpc("primary", {
cidrBlock: "10.6.0.0/16",
enableDnsHostnames: true,
enableDnsSupport: true,
});
const secondary = new aws.ec2.Vpc("secondary", {
cidrBlock: "10.7.0.0/16",
enableDnsHostnames: true,
enableDnsSupport: true,
});
const _private = new aws.route53.Zone("private", {
vpcs: [
{
vpcId: primary.id,
},
{
vpcId: secondary.id,
},
],
name: "example.com",
});
import pulumi
import pulumi_aws as aws
primary = aws.ec2.Vpc("primary",
cidr_block="10.6.0.0/16",
enable_dns_hostnames=True,
enable_dns_support=True)
secondary = aws.ec2.Vpc("secondary",
cidr_block="10.7.0.0/16",
enable_dns_hostnames=True,
enable_dns_support=True)
private = aws.route53.Zone("private",
vpcs=[
{
"vpc_id": primary.id,
},
{
"vpc_id": secondary.id,
},
],
name="example.com")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var primary = new Aws.Ec2.Vpc("primary", new()
{
CidrBlock = "10.6.0.0/16",
EnableDnsHostnames = true,
EnableDnsSupport = true,
});
var secondary = new Aws.Ec2.Vpc("secondary", new()
{
CidrBlock = "10.7.0.0/16",
EnableDnsHostnames = true,
EnableDnsSupport = true,
});
var @private = new Aws.Route53.Zone("private", new()
{
Vpcs = new[]
{
new Aws.Route53.Inputs.ZoneVpcArgs
{
VpcId = primary.Id,
},
new Aws.Route53.Inputs.ZoneVpcArgs
{
VpcId = secondary.Id,
},
},
Name = "example.com",
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/ec2"
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/route53"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
primary, err := ec2.NewVpc(ctx, "primary", &ec2.VpcArgs{
CidrBlock: pulumi.String("10.6.0.0/16"),
EnableDnsHostnames: pulumi.Bool(true),
EnableDnsSupport: pulumi.Bool(true),
})
if err != nil {
return err
}
secondary, err := ec2.NewVpc(ctx, "secondary", &ec2.VpcArgs{
CidrBlock: pulumi.String("10.7.0.0/16"),
EnableDnsHostnames: pulumi.Bool(true),
EnableDnsSupport: pulumi.Bool(true),
})
if err != nil {
return err
}
_, err = route53.NewZone(ctx, "private", &route53.ZoneArgs{
Vpcs: route53.ZoneVpcArray{
&route53.ZoneVpcArgs{
VpcId: primary.ID().ToIDOutput().ToStringOutput(),
},
&route53.ZoneVpcArgs{
VpcId: secondary.ID().ToIDOutput().ToStringOutput(),
},
},
Name: pulumi.String("example.com"),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_ec2_vpc" "primary" {
cidr_block = "10.6.0.0/16"
enable_dns_hostnames = true
enable_dns_support = true
}
resource "aws_ec2_vpc" "secondary" {
cidr_block = "10.7.0.0/16"
enable_dns_hostnames = true
enable_dns_support = true
}
resource "aws_route53_zone" "private" {
vpcs {
vpc_id = aws_ec2_vpc.primary.id
}
vpcs {
vpc_id = aws_ec2_vpc.secondary.id
}
name = "example.com"
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.Vpc;
import com.pulumi.aws.ec2.VpcArgs;
import com.pulumi.aws.route53.Zone;
import com.pulumi.aws.route53.ZoneArgs;
import com.pulumi.aws.route53.inputs.ZoneVpcArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var primary = new Vpc("primary", VpcArgs.builder()
.cidrBlock("10.6.0.0/16")
.enableDnsHostnames(true)
.enableDnsSupport(true)
.build());
var secondary = new Vpc("secondary", VpcArgs.builder()
.cidrBlock("10.7.0.0/16")
.enableDnsHostnames(true)
.enableDnsSupport(true)
.build());
var private_ = new Zone("private", ZoneArgs.builder()
.vpcs(
ZoneVpcArgs.builder()
.vpcId(primary.id())
.build(),
ZoneVpcArgs.builder()
.vpcId(secondary.id())
.build())
.name("example.com")
.build());
}
}
resources:
primary:
type: aws:ec2:Vpc
properties:
cidrBlock: 10.6.0.0/16
enableDnsHostnames: true
enableDnsSupport: true
secondary:
type: aws:ec2:Vpc
properties:
cidrBlock: 10.7.0.0/16
enableDnsHostnames: true
enableDnsSupport: true
private:
type: aws:route53:Zone
properties:
vpcs:
- vpcId: ${primary.id}
- vpcId: ${secondary.id}
name: example.com
Import
Identity Schema
Required
zoneId(String) The Hosted Zone ID.
Optional
accountId(String) AWS Account where this resource is managed.
Using pulumi import, import Route53 Zones using the zone id. For example:
$ pulumi import aws:route53/zone:Zone myzone Z1D633PJN98FT9
Constructors
- Zone(String name, {ZoneArgs? args, CustomResourceOptions? options})
-
Creates a new Zone.
nameThe Pulumi resource name.argsArguments used to configure this Zone. The set of arguments for Zone.optionsResource options controlling this resource's behavior. - Zone.reference(String urn)
- Creates a typed reference to an existing Zone resource.
Properties
-
arn
↔ Output<
String> -
ARN of the Hosted Zone.
latefinal
-
childResources
→ Set<
Resource> -
finalinherited
-
comment
↔ Output<
String> -
A comment for the hosted zone. Defaults to 'Managed by Pulumi'.
latefinal
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
-
delegationSetId
↔ Output<
String?> -
The ID of the reusable delegation set whose NS records you want to assign to the hosted zone. Conflicts with
vpcas delegation sets can only be used for public zones.latefinal -
enableAcceleratedRecovery
↔ Output<
bool> -
Boolean to indicate whether to enable accelerated recovery for the hosted zone. Defaults to
false. Once set, switching tofalserequires explicitly specifyingfalserather than removing the argument.latefinal -
forceDestroy
↔ Output<
bool?> -
Whether to destroy all records (possibly managed outside of this provider) in the zone when destroying the zone.
latefinal
- hashCode → int
-
The hash code for this object.
no setterinherited
-
id
↔ Output<
String> -
getter/setter pairinherited
- isCustom → bool
-
Returns whether this resource is provider-managed.
no setterinherited
- isProtected → bool
-
Returns whether this resource is protected from deletion.
no setterinherited
- isRemote → bool
-
Whether this resource is registered as remote.
no setterinherited
- isResourceReference → bool
-
Whether this instance represents a resource value returned over RPC.
finalinherited
-
name
↔ Output<
String> -
This is the name of the hosted zone.
latefinal
-
nameServers
↔ Output<
List< String> > -
A list of name servers in associated (or default) delegation set.
Find more about delegation sets in AWS docs.
latefinal
-
primaryNameServer
↔ Output<
String> -
The Route 53 name server that created the SOA record.
latefinal
-
resourceTransforms
→ List<
ResourceTransform> -
Inherited/explicit async transforms.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
A mapping of tags to assign to the zone. If configured with a provider
defaultTagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.latefinal -
A map of tags assigned to the resource, including those inherited from the provider
defaultTagsconfiguration block.latefinal -
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
urn
↔ Output<
String> -
latefinalinherited
-
vpcs
↔ Output<
List< ZoneVpc> ?> -
Configuration block(s) specifying VPC(s) to associate with a private hosted zone. Conflicts with the
delegationSetIdargument in this resource and anyaws.route53.ZoneAssociationresource specifying the same zone ID. Detailed below.latefinal -
zoneId
↔ Output<
String> -
The Hosted Zone ID. This can be referenced by zone records.
latefinal
Methods
-
failId(
Object error) → void -
Completes this resource ID with an error when registration fails.
inherited
-
failOutputs(
Object error) → void -
Completes all output properties with
error.inherited -
failUrn(
Object error) → void -
Completes this resource URN with an error when registration fails.
inherited
-
getProvider(
String moduleMember) → ProviderResource? -
Returns provider for
moduleMember's package, if configured.inherited -
getResourceName(
) → String -
Returns this resource's logical name.
inherited
-
getResourceType(
) → String -
Returns this resource's Pulumi type token.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerOutput<
T> (String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output< T> -
Registers a dynamic output property for this resource.
inherited
-
resolveId(
String? value, {required bool isKnown}) → void -
Resolves the provider-assigned ID for this resource.
inherited
-
resolveOutputs(
Struct outputs) → void -
Resolves all output properties from a monitor response payload.
inherited
-
resolveUrn(
String value) → void -
Resolves this resource's URN once assigned by the engine.
inherited
-
serializeProperties(
Map< String, dynamic> properties) → Future<Struct> -
Serializes resource properties for RPC transmission.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited