Menu
Amazon Route 53
API Reference

CreateTrafficPolicyInstance

Creates resource record sets in a specified hosted zone based on the settings in a specified traffic policy version. In addition, CreateTrafficPolicyInstance associates the resource record sets with a specified domain name (such as example.com) or subdomain name (such as www.example.com). Amazon Route 53 responds to DNS queries for the domain or subdomain name by using the resource record sets that CreateTrafficPolicyInstance created.

Request Syntax

Copy
POST /2013-04-01/trafficpolicyinstance HTTP/1.1 <?xml version="1.0" encoding="UTF-8"?> <CreateTrafficPolicyInstanceRequest xmlns="https://route53.amazonaws.com/doc/2013-04-01/"> <HostedZoneId>string</HostedZoneId> <Name>string</Name> <TrafficPolicyId>string</TrafficPolicyId> <TrafficPolicyVersion>integer</TrafficPolicyVersion> <TTL>long</TTL> </CreateTrafficPolicyInstanceRequest>

URI Request Parameters

The request does not use any URI parameters.

Request Body

The request accepts the following data in XML format.

CreateTrafficPolicyInstanceRequest

Root level tag for the CreateTrafficPolicyInstanceRequest parameters.

Required: Yes

HostedZoneId

The ID of the hosted zone in which you want Amazon Route 53 to create resource record sets by using the configuration in a traffic policy.

Type: String

Length Constraints: Maximum length of 32.

Required: Yes

Name

The domain name (such as example.com) or subdomain name (such as www.example.com) for which Amazon Route 53 responds to DNS queries by using the resource record sets that Amazon Route 53 creates for this traffic policy instance.

Type: String

Length Constraints: Maximum length of 1024.

Required: Yes

TrafficPolicyId

The ID of the traffic policy that you want to use to create resource record sets in the specified hosted zone.

Type: String

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

Required: Yes

TrafficPolicyVersion

The version of the traffic policy that you want to use to create resource record sets in the specified hosted zone.

Type: Integer

Valid Range: Minimum value of 1. Maximum value of 1000.

Required: Yes

TTL

(Optional) The TTL that you want Amazon Route 53 to assign to all of the resource record sets that it creates in the specified hosted zone.

Type: Long

Valid Range: Minimum value of 0. Maximum value of 2147483647.

Required: Yes

Response Syntax

Copy
HTTP/1.1 201 Location: Location <?xml version="1.0" encoding="UTF-8"?> <CreateTrafficPolicyInstanceResponse> <TrafficPolicyInstance> <HostedZoneId>string</HostedZoneId> <Id>string</Id> <Message>string</Message> <Name>string</Name> <State>string</State> <TrafficPolicyId>string</TrafficPolicyId> <TrafficPolicyType>string</TrafficPolicyType> <TrafficPolicyVersion>integer</TrafficPolicyVersion> <TTL>long</TTL> </TrafficPolicyInstance> </CreateTrafficPolicyInstanceResponse>

Response Elements

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

The response returns the following HTTP headers.

Location

A unique URL that represents a new traffic policy instance.

Length Constraints: Maximum length of 1024.

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

CreateTrafficPolicyInstanceResponse

Root level tag for the CreateTrafficPolicyInstanceResponse parameters.

Required: Yes

TrafficPolicyInstance

A complex type that contains settings for the new traffic policy instance.

Type: TrafficPolicyInstance object

Errors

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

InvalidInput

The input is not valid.

HTTP Status Code: 400

NoSuchHostedZone

No hosted zone exists with the ID that you specified.

HTTP Status Code: 404

NoSuchTrafficPolicy

No traffic policy exists with the specified ID.

HTTP Status Code: 404

TooManyTrafficPolicyInstances

You've created the maximum number of traffic policy instances that can be created for the current AWS account. You can request an increase to the limit on the Contact Us page.

HTTP Status Code: 400

TrafficPolicyInstanceAlreadyExists

Traffic policy instance with given Id already exists.

HTTP Status Code: 409

Examples

Example Request

Copy
POST /2013-04-01/trafficpolicyinstance HTTP/1.1 <?xml version="1.0" encoding="UTF-8"?> <CreateTrafficPolicyInstanceRequest xmlns="https://route53.amazonaws.com/doc/2013-04-01/"> <HostedZoneId>Z1D633PJN98FT9</HostedZoneId> <Name>www.example.com</Name> <TTL>300</TTL> <TrafficPolicyId>12345678-abcd-9876-fedc-1a2b3c4de5f6</TrafficPolicyId> <TrafficPolicyVersion>3</TrafficPolicyVersion> </CreateTrafficPolicyInstanceRequest>

Example Response

Copy
HTTP/1.1 200 OK <?xml version="1.0" encoding="UTF-8"?> <CreateTrafficPolicyInstanceResponse xmlns="https://route53.amazonaws.com/doc/2013-04-01/"> <TrafficPolicyInstance> <Id>12131415-abac-5432-caba-6f5e4d3c2b1a</Id> <HostedZoneId>Z1D633PJN98FT9</HostedZoneId> <Name>www.example.com</Name> <TTL>300</TTL> <State>Applied</State> <Message/> <TrafficPolicyId>12345678-abcd-9876-fedc-1a2b3c4de5f6</TrafficPolicyId> <TrafficPolicyVersion>3</TrafficPolicyVersion> <TrafficPolicyType>A</TrafficPolicyType> </TrafficPolicyInstance> </CreateTrafficPolicyInstanceResponse>

See Also

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