Menu
Amazon Route 53
API Reference (API Version 2013-04-01)

CreateHostedZone

Creates a new public hosted zone, which you use to specify how the Domain Name System (DNS) routes traffic on the Internet for a domain, such as example.com, and its subdomains.

Important

You can't convert a public hosted zones to a private hosted zone or vice versa. Instead, you must create a new hosted zone with the same name and create new resource record sets.

For more information about charges for hosted zones, see Amazon Route 53 Pricing.

Note the following:

  • You can't create a hosted zone for a top-level domain (TLD).

  • Amazon Route 53 automatically creates a default SOA record and four NS records for the zone. For more information about SOA and NS records, see NS and SOA Records that Amazon Route 53 Creates for a Hosted Zone in the Amazon Route 53 Developer Guide.

    If you want to use the same name servers for multiple hosted zones, you can optionally associate a reusable delegation set with the hosted zone. See the DelegationSetId element.

  • If your domain is registered with a registrar other than Amazon Route 53, you must update the name servers with your registrar to make Amazon Route 53 your DNS service. For more information, see Configuring Amazon Route 53 as your DNS Service in the Amazon Route 53 Developer Guide.

When you submit a CreateHostedZone request, the initial status of the hosted zone is PENDING. This means that the NS and SOA records are not yet available on all Amazon Route 53 DNS servers. When the NS and SOA records are available, the status of the zone changes to INSYNC.

Request Syntax

Copy
POST /2013-04-01/hostedzone HTTP/1.1 <?xml version="1.0" encoding="UTF-8"?> <CreateHostedZoneRequest xmlns="https://route53.amazonaws.com/doc/2013-04-01/"> <CallerReference>string</CallerReference> <DelegationSetId>string</DelegationSetId> <HostedZoneConfig> <Comment>string</Comment> <PrivateZone>boolean</PrivateZone> </HostedZoneConfig> <Name>string</Name> <VPC> <VPCId>string</VPCId> <VPCRegion>string</VPCRegion> </VPC> </CreateHostedZoneRequest>

URI Request Parameters

The request does not use any URI parameters.

Request Body

The request requires the following data in XML format.

CreateHostedZoneRequest

Root level tag for the CreateHostedZoneRequest parameters.

Required: Yes

CallerReference

A unique string that identifies the request and that allows failed CreateHostedZone requests to be retried without the risk of executing the operation twice. You must use a unique CallerReference string every time you submit a CreateHostedZone request. CallerReference can be any unique string, for example, a date/time stamp.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 128.

Required: Yes

DelegationSetId

If you want to associate a reusable delegation set with this hosted zone, the ID that Amazon Route 53 assigned to the reusable delegation set when you created it. For more information about reusable delegation sets, see CreateReusableDelegationSet.

Type: String

Length Constraints: Maximum length of 32.

Required: No

HostedZoneConfig

(Optional) A complex type that contains the following optional values:

  • For public and private hosted zones, an optional comment

  • For private hosted zones, an optional PrivateZone element

If you don't specify a comment or the PrivateZone element, omit HostedZoneConfig and the other elements.

Type: HostedZoneConfig object

Required: No

Name

The name of the domain. For resource record types that include a domain name, specify a fully qualified domain name, for example, www.example.com. The trailing dot is optional; Amazon Route 53 assumes that the domain name is fully qualified. This means that Amazon Route 53 treats www.example.com (without a trailing dot) and www.example.com. (with a trailing dot) as identical.

If you're creating a public hosted zone, this is the name you have registered with your DNS registrar. If your domain name is registered with a registrar other than Amazon Route 53, change the name servers for your domain to the set of NameServers that CreateHostedZone returns in DelegationSet.

Type: String

Length Constraints: Maximum length of 1024.

Required: Yes

VPC

(Private hosted zones only) A complex type that contains information about the Amazon VPC that you're associating with this hosted zone.

You can specify only one Amazon VPC when you create a private hosted zone. To associate additional Amazon VPCs with the hosted zone, use AssociateVPCWithHostedZone after you create a hosted zone.

Type: VPC object

Required: No

Response Syntax

Copy
HTTP/1.1 201 Location: Location <?xml version="1.0" encoding="UTF-8"?> <CreateHostedZoneResponse> <ChangeInfo> <Comment>string</Comment> <Id>string</Id> <Status>string</Status> <SubmittedAt>timestamp</SubmittedAt> </ChangeInfo> <DelegationSet> <CallerReference>string</CallerReference> <Id>string</Id> <NameServers> <NameServer>string</NameServer> </NameServers> </DelegationSet> <HostedZone> <CallerReference>string</CallerReference> <Config> <Comment>string</Comment> <PrivateZone>boolean</PrivateZone> </Config> <Id>string</Id> <Name>string</Name> <ResourceRecordSetCount>long</ResourceRecordSetCount> </HostedZone> <VPC> <VPCId>string</VPCId> <VPCRegion>string</VPCRegion> </VPC> </CreateHostedZoneResponse>

Response Elements

If the action is successful, the service sends back an HTTP 201 response.

The response returns the following HTTP headers.

Location

The unique URL representing the new hosted zone.

Length Constraints: Maximum length of 1024.

The following data is returned in XML format by the service.

CreateHostedZoneResponse

Root level tag for the CreateHostedZoneResponse parameters.

Required: Yes

ChangeInfo

A complex type that contains information about the CreateHostedZone request.

Type: ChangeInfo object

DelegationSet

A complex type that describes the name servers for this hosted zone.

Type: DelegationSet object

HostedZone

A complex type that contains general information about the hosted zone.

Type: HostedZone object

VPC

A complex type that contains information about an Amazon VPC that you associated with this hosted zone.

Type: VPC object

Errors

For information about the errors that are common to all actions, see Common Errors.

ConflictingDomainExists

The cause of this error depends on whether you're trying to create a public or a private hosted zone:

  • Public hosted zone: Two hosted zones that have the same name or that have a parent/child relationship (example.com and test.example.com) can't have any common name servers. You tried to create a hosted zone that has the same name as an existing hosted zone or that's the parent or child of an existing hosted zone, and you specified a delegation set that shares one or more name servers with the existing hosted zone.

  • Private hosted zone: You specified an Amazon VPC that you're already using for another hosted zone, and the domain that you specified for one of the hosted zones is a subdomain of the domain that you specified for the other hosted zone. For example, you can't use the same Amazon VPC for the hosted zones for example.com and test.example.com.

HTTP Status Code: 400

DelegationSetNotAvailable

You can create a hosted zone that has the same name as an existing hosted zone (example.com is common), but there is a limit to the number of hosted zones that have the same name. If you get this error, Amazon Route 53 has reached that limit. If you own the domain name and Amazon Route 53 generates this error, contact Customer Support.

HTTP Status Code: 400

DelegationSetNotReusable

A reusable delegation set with the specified ID does not exist.

HTTP Status Code: 400

HostedZoneAlreadyExists

The hosted zone you're trying to create already exists. Amazon Route 53 returns this error when a hosted zone has already been created with the specified CallerReference.

HTTP Status Code: 409

InvalidDomainName

The specified domain name is not valid.

HTTP Status Code: 400

InvalidInput

The input is not valid.

HTTP Status Code: 400

InvalidVPCId

The VPC ID that you specified either isn't a valid ID or the current account is not authorized to access this VPC.

HTTP Status Code: 400

NoSuchDelegationSet

A reusable delegation set with the specified ID does not exist.

HTTP Status Code: 400

TooManyHostedZones

This hosted zone can't be created because the hosted zone limit is exceeded. To request a limit increase, go to the Amazon Route 53 Contact Us page.

HTTP Status Code: 400

Examples

Example Request (Public Hosted Zone)

Copy
POST /2013-04-01/hostedzone HTTP/1.1 <?xml version="1.0" encoding="UTF-8"?> <CreateHostedZoneRequest xmlns="https://route53.amazonaws.com/doc/2013-04-01/"> <Name>example.com</Name> <CallerReference>myUniqueIdentifier</CallerReference> <HostedZoneConfig> <Comment>This is my first hosted zone.</Comment> </HostedZoneConfig> <DelegationSetId>NZ8X2CISAMPLE</DelegationSetId> </CreateHostedZoneRequest>

Example Response (Public Hosted Zone)

Copy
HTTP/1.1 201 Created <?xml version="1.0" encoding="UTF-8"?> <CreateHostedZoneResponse xmlns="https://route53.amazonaws.com/doc/2013-04-01/"> <HostedZone> <Id>/hostedzone/Z1PA6795UKMFR9</Id> <Name>example.com.</Name> <CallerReference>myUniqueIdentifier</CallerReference> <Config> <Comment>This is my first hosted zone.</Comment> <PrivateZone>false</PrivateZone> </Config> <ResourceRecordSetCount>2</ResourceRecordSetCount> </HostedZone> <ChangeInfo> <Id>/change/C1PA6795UKMFR9</Id> <Status>PENDING</Status> <SubmittedAt>2017-03-15T01:36:41.958Z</SubmittedAt> </ChangeInfo> <DelegationSet> <Id>NZ8X2CISAMPLE</Id> <CallerReference>2017-03-01T11:44:14.448Z</Id> <NameServers> <NameServer>ns-2048.awsdns-64.com</NameServer> <NameServer>ns-2049.awsdns-65.net</NameServer> <NameServer>ns-2050.awsdns-66.org</NameServer> <NameServer>ns-2051.awsdns-67.co.uk</NameServer> </NameServers> </DelegationSet> </CreateHostedZoneResponse>

Example Request (Private Hosted Zone)

Copy
POST /2013-04-01/hostedzone HTTP/1.1 <?xml version="1.0" encoding="UTF-8"?> <CreateHostedZoneRequest xmlns="https://route53.amazonaws.com/doc/2013-04-01/"> <Name>example.com</Name> <VPC> <VPCId>vpc-1a2b3c4d</VPCId> <VPCRegion>us-east-2</VPCRegion> </VPC> <CallerReference>myUniqueIdentifier</CallerReference> <HostedZoneConfig> <Comment>This is my first hosted zone.</Comment> </HostedZoneConfig> </CreateHostedZoneRequest>

Example Response (Private Hosted Zone)

Copy
HTTP/1.1 201 Created <?xml version="1.0" encoding="UTF-8"?> <CreateHostedZoneResponse xmlns="https://route53.amazonaws.com/doc/2013-04-01/"> <HostedZone> <Id>/hostedzone/Z1D633PJN98FT9</Id> <Name>example.com.</Name> <VPC> <VPCId>vpc-1a2b3c4d</VPCId> <VPCRegion>us-east-2</VPCRegion> </VPC> <CallerReference>myUniqueIdentifier</CallerReference> <Config> <Comment>This is my first hosted zone.</Comment> <PrivateZone>true</PrivateZone> </Config> <ResourceRecordSetCount>2</ResourceRecordSetCount> </HostedZone> <ChangeInfo> <Id>/change/C1PA6795UKMFR9</Id> <Status>PENDING</Status> <SubmittedAt>2017-03-15T01:36:41.958Z</SubmittedAt> </ChangeInfo> </CreateHostedZoneResponse>

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: