traffic_policies
Creates, updates, deletes, gets or lists a traffic_policies resource.
Overview
| Name | traffic_policies |
| Type | Resource |
| Id | aws.route53.traffic_policies |
Fields
The following fields are returned by SELECT queries:
- get_traffic_policy
- list_traffic_policies
| Name | Datatype | Description |
|---|---|---|
comment | string | The comment that you specify in the CreateTrafficPolicy request, if any. |
document | string | The definition of a traffic policy in JSON format. You specify the JSON document to use for a new traffic policy in the CreateTrafficPolicy request. For more information about the JSON format, see Traffic Policy Document Format. |
id | string | The ID that Amazon Route 53 assigned to a traffic policy when you created it. |
name | string | The name that you specified when you created the traffic policy. |
type | string | The DNS type of the resource record sets that Amazon Route 53 creates when you use a traffic policy to create a traffic policy instance. |
version | integer | The version number that Amazon Route 53 assigns to a traffic policy. For a new traffic policy, the value of Version is always 1. |
| Name | Datatype | Description |
|---|---|---|
id | string | The ID that Amazon Route 53 assigned to the traffic policy when you created it. |
latest_version | integer | The version number of the latest version of the traffic policy. |
name | string | The name that you specified for the traffic policy when you created it. |
traffic_policy_count | integer | The number of traffic policies that are associated with the current Amazon Web Services account. |
type | string | The DNS type of the resource record sets that Amazon Route 53 creates when you use a traffic policy to create a traffic policy instance. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_traffic_policy | select | id, version, region | Gets information about a specific traffic policy version. For information about how of deleting a traffic policy affects the response from GetTrafficPolicy, see DeleteTrafficPolicy. | |
list_traffic_policies | select | region | trafficpolicyid, maxitems | Gets information about the latest version for every traffic policy that is associated with the current Amazon Web Services account. Policies are listed in the order that they were created in. For information about how of deleting a traffic policy affects the response from ListTrafficPolicies, see DeleteTrafficPolicy. |
create_traffic_policy | insert | region | Creates a traffic policy, which you use to create multiple DNS resource record sets for one domain name (such as example.com) or one subdomain name (such as www.example.com). | |
update_traffic_policy_comment | update | id, version, region | Updates the comment for a specified traffic policy version. | |
delete_traffic_policy | delete | id, version, region | Deletes a traffic policy. When you delete a traffic policy, Route 53 sets a flag on the policy to indicate that it has been deleted. However, Route 53 never fully deletes the traffic policy. Note the following: Deleted traffic policies aren't listed if you run ListTrafficPolicies. There's no way to get a list of deleted policies. If you retain the ID of the policy, you can get information about the policy, including the traffic policy document, by running GetTrafficPolicy. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
id | string | The ID of the traffic policy that you want to delete. |
region | string | AWS region (default: us-east-1) |
version | integer | The version number of the traffic policy that you want to delete. |
maxitems | string | (Optional) The maximum number of traffic policies that you want Amazon Route 53 to return in response to this request. If you have more than MaxItems traffic policies, the value of IsTruncated in the response is true, and the value of TrafficPolicyIdMarker is the ID of the first traffic policy that Route 53 will return if you submit another request. |
trafficpolicyid | string | (Conditional) For your first request to ListTrafficPolicies, don't include the TrafficPolicyIdMarker parameter. If you have more traffic policies than the value of MaxItems, ListTrafficPolicies returns only the first MaxItems traffic policies. To get the next group of policies, submit another request to ListTrafficPolicies. For the value of TrafficPolicyIdMarker, specify the value of TrafficPolicyIdMarker that was returned in the previous response. |
SELECT examples
- get_traffic_policy
- list_traffic_policies
Gets information about a specific traffic policy version. For information about how of deleting a traffic policy affects the response from GetTrafficPolicy, see DeleteTrafficPolicy.
SELECT
comment,
document,
id,
name,
type,
version
FROM aws.route53.traffic_policies
WHERE id = '{{ id }}' -- required
AND version = '{{ version }}' -- required
AND region = '{{ region }}' -- required
;
Gets information about the latest version for every traffic policy that is associated with the current Amazon Web Services account. Policies are listed in the order that they were created in. For information about how of deleting a traffic policy affects the response from ListTrafficPolicies, see DeleteTrafficPolicy.
SELECT
id,
latest_version,
name,
traffic_policy_count,
type
FROM aws.route53.traffic_policies
WHERE region = '{{ region }}' -- required
AND trafficpolicyid = '{{ trafficpolicyid }}'
AND maxitems = '{{ maxitems }}'
;
INSERT examples
- create_traffic_policy
- Manifest
Creates a traffic policy, which you use to create multiple DNS resource record sets for one domain name (such as example.com) or one subdomain name (such as www.example.com).
INSERT INTO aws.route53.traffic_policies (
Name,
Document,
Comment,
region
)
SELECT
'{{ Name }}',
'{{ Document }}',
'{{ Comment }}',
'{{ region }}'
RETURNING
comment,
document,
id,
name,
type,
version
;
# Description fields are for documentation purposes
- name: traffic_policies
props:
- name: region
value: "{{ region }}"
description: Required parameter for the traffic_policies resource.
- name: Name
value: "{{ Name }}"
- name: Document
value: "{{ Document }}"
- name: Comment
value: "{{ Comment }}"
UPDATE examples
- update_traffic_policy_comment
Updates the comment for a specified traffic policy version.
UPDATE aws.route53.traffic_policies
SET
Comment = '{{ Comment }}'
WHERE
id = '{{ id }}' --required
AND version = '{{ version }}' --required
AND region = '{{ region }}' --required
RETURNING
comment,
document,
id,
name,
type,
version;
DELETE examples
- delete_traffic_policy
Deletes a traffic policy. When you delete a traffic policy, Route 53 sets a flag on the policy to indicate that it has been deleted. However, Route 53 never fully deletes the traffic policy. Note the following: Deleted traffic policies aren't listed if you run ListTrafficPolicies. There's no way to get a list of deleted policies. If you retain the ID of the policy, you can get information about the policy, including the traffic policy document, by running GetTrafficPolicy.
DELETE FROM aws.route53.traffic_policies
WHERE id = '{{ id }}' --required
AND version = '{{ version }}' --required
AND region = '{{ region }}' --required
;