AWS Tools for Windows PowerShell
Command Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Synopsis

Invokes the ChangeResourceRecordSets operation against Amazon Route 53.

Syntax

Edit-R53ResourceRecordSet
-HostedZoneId <String>
-ChangeBatch_Comment <String>
-ChangeBatch_Change <Change[]>
-Force <SwitchParameter>

Description

Creates, changes, or deletes a resource record set, which contains authoritative DNS information for a specified domain name or subdomain name. For example, you can use ChangeResourceRecordSets to create a resource record set that routes traffic for test.example.com to a web server that has an IP address of 192.0.2.44. Change Batches and Transactional Changes The request body must include a document with a ChangeResourceRecordSetsRequest element. The request body contains a list of change items, known as a change batch. Change batches are considered transactional changes. When using the Amazon Route 53 API to change resource record sets, Amazon Route 53 either makes all or none of the changes in a change batch request. This ensures that Amazon Route 53 never partially implements the intended changes to the resource record sets in a hosted zone. For example, a change batch request that deletes the CNAME record for www.example.com and creates an alias resource record set for www.example.com. Amazon Route 53 deletes the first resource record set and creates the second resource record set in a single operation. If either the DELETE or the CREATE action fails, then both changes (plus any other changes in the batch) fail, and the original CNAME record continues to exist. Due to the nature of transactional changes, you can't delete the same resource record set more than once in a single change batch. If you attempt to delete the same change batch more than once, Amazon Route 53 returns an InvalidChangeBatch error. Traffic Flow To create resource record sets for complex routing configurations, use either the traffic flow visual editor in the Amazon Route 53 console or the API actions for traffic policies and traffic policy instances. Save the configuration as a traffic policy, then associate the traffic policy with one or more domain names (such as example.com) or subdomain names (such as www.example.com), in the same hosted zone or in multiple hosted zones. You can roll back the updates if the new configuration isn't performing as expected. For more information, see Using Traffic Flow to Route DNS Traffic in the Amazon Route 53 Developer Guide. Create, Delete, and Upsert Use ChangeResourceRecordsSetsRequest to perform the following actions:
  • CREATE: Creates a resource record set that has the specified values.
  • DELETE: Deletes an existing resource record set that has the specified values.
  • UPSERT: If a resource record set does not already exist, AWS creates it. If a resource set does exist, Amazon Route 53 updates it with the values in the request.
Syntaxes for Creating, Updating, and Deleting Resource Record Sets The syntax for a request depends on the type of resource record set that you want to create, delete, or update, such as weighted, alias, or failover. The XML elements in your request must appear in the order listed in the syntax. For an example for each type of resource record set, see "Examples." Don't refer to the syntax in the "Parameter Syntax" section, which includes all of the elements for every kind of resource record set that you can create, delete, or update by using ChangeResourceRecordSets. Change Propagation to Amazon Route 53 DNS Servers When you submit a ChangeResourceRecordSets request, Amazon Route 53 propagates your changes to all of the Amazon Route 53 authoritative DNS servers. While your changes are propagating, GetChange returns a status of PENDING. When propagation is complete, GetChange returns a status of INSYNC. Changes generally propagate to all Amazon Route 53 name servers within 60 seconds. For more information, see GetChange. Limits on ChangeResourceRecordSets Requests For information about the limits on a ChangeResourceRecordSets request, see Limits in the Amazon Route 53 Developer Guide.

Parameters

-ChangeBatch_Change <Change[]>
Information about the changes to make to the record sets.
Required?False
Position?3
Accept pipeline input?False
-ChangeBatch_Comment <String>
Optional: Any comments you want to include about a change batch request.
Required?False
Position?2
Accept pipeline input?False
-Force <SwitchParameter>
This parameter overrides confirmation prompts to force the cmdlet to continue its operation. This parameter should always be used with caution.
Required?False
Position?Named
Accept pipeline input?False
-HostedZoneId <String>
The ID of the hosted zone that contains the resource record sets that you want to change.
Required?False
Position?1
Accept pipeline input?True (ByValue, ByPropertyName)

Common Credential and Region Parameters

-AccessKey <String>
The AWS access key for the user account. This can be a temporary access key if the corresponding session token is supplied to the -SessionToken parameter.
Required? False
Position? Named
Accept pipeline input? False
-Credential <AWSCredentials>
An AWSCredentials object instance containing access and secret key information, and optionally a token for session-based credentials.
Required? False
Position? Named
Accept pipeline input? False
-ProfileLocation <String>

Used to specify the name and location of the ini-format credential file (shared with the AWS CLI and other AWS SDKs)

If this optional parameter is omitted this cmdlet will search the encrypted credential file used by the AWS SDK for .NET and AWS Toolkit for Visual Studio first. If the profile is not found then the cmdlet will search in the ini-format credential file at the default location: (user's home directory)\.aws\credentials. Note that the encrypted credential file is not supported on all platforms. It will be skipped when searching for profiles on Windows Nano Server, Mac, and Linux platforms.

If this parameter is specified then this cmdlet will only search the ini-format credential file at the location given.

As the current folder can vary in a shell or during script execution it is advised that you use specify a fully qualified path instead of a relative path.

Required? False
Position? Named
Accept pipeline input? False
-ProfileName <String>
The user-defined name of an AWS credentials or SAML-based role profile containing credential information. The profile is expected to be found in the secure credential file shared with the AWS SDK for .NET and AWS Toolkit for Visual Studio. You can also specify the name of a profile stored in the .ini-format credential file used with the AWS CLI and other AWS SDKs.
Required? False
Position? Named
Accept pipeline input? False
-NetworkCredential <PSCredential>
Used with SAML-based authentication when ProfileName references a SAML role profile. Contains the network credentials to be supplied during authentication with the configured identity provider's endpoint. This parameter is not required if the user's default network identity can or should be used during authentication.
Required? False
Position? Named
Accept pipeline input? False
-SecretKey <String>
The AWS secret key for the user account. This can be a temporary secret key if the corresponding session token is supplied to the -SessionToken parameter.
Required? False
Position? Named
Accept pipeline input? False
-SessionToken <String>
The session token if the access and secret keys are temporary session-based credentials.
Required? False
Position? Named
Accept pipeline input? False
-Region <String>
The system name of the AWS region in which the operation should be invoked. For example, us-east-1, eu-west-1 etc.
Required? False
Position? Named
Accept pipeline input? False
-EndpointUrl <String>

The endpoint to make the call against.

Note: This parameter is primarily for internal AWS use and is not required/should not be specified for normal usage. The cmdlets normally determine which endpoint to call based on the region specified to the -Region parameter or set as default in the shell (via Set-DefaultAWSRegion). Only specify this parameter if you must direct the call to a specific custom endpoint.

Required? False
Position? Named
Accept pipeline input? False

Inputs

You can pipe a String object to this cmdlet for the HostedZoneId parameter.

Outputs

This cmdlet returns a ChangeInfo object. The service call response (type Amazon.Route53.Model.ChangeResourceRecordSetsResponse) can also be referenced from properties attached to the cmdlet entry in the $AWSHistory stack.

Examples

Example 1

PS C:\> $change1 = New-Object Amazon.Route53.Model.Change
PS C:\> $change1.Action = "CREATE"
PS C:\> $change1.ResourceRecordSet = New-Object Amazon.Route53.Model.ResourceRecordSet
PS C:\> $change1.ResourceRecordSet.Name = "www.example.com"
PS C:\> $change1.ResourceRecordSet.Type = "TXT"
PS C:\> $change1.ResourceRecordSet.TTL = 600
PS C:\> $change1.ResourceRecordSet.ResourceRecords.Add(@{Value="item 1 item 2 item 3"})

PS C:\> $change2 = New-Object Amazon.Route53.Model.Change
PS C:\> $change2.Action = "DELETE"
PS C:\> $change2.ResourceRecordSet = New-Object Amazon.Route53.Model.ResourceRecordSet
PS C:\> $change2.ResourceRecordSet.Name = "test.example.com"
PS C:\> $change2.ResourceRecordSet.Type = "A"
PS C:\> $change2.ResourceRecordSet.TTL = 600
PS C:\> $change2.ResourceRecordSet.ResourceRecords.Add(@{Value="192.0.2.3"})

PS C:\> $change3 = New-Object Amazon.Route53.Model.Change
PS C:\> $change3.Action = "CREATE"
PS C:\> $change3.ResourceRecordSet = New-Object Amazon.Route53.Model.ResourceRecordSet
PS C:\> $change3.ResourceRecordSet.Name = "test.example.com"
PS C:\> $change3.ResourceRecordSet.Type = "A"
PS C:\> $change3.ResourceRecordSet.TTL = 600
PS C:\> $change3.ResourceRecordSet.ResourceRecords.Add(@{Value="192.0.2.1"})

PS C:\> $params = @{
HostedZoneId="Z1PA6795UKMFR9"
ChangeBatch_Comment="This change batch creates a TXT record for www.example.com. and changes the A record for test.example.com. from 192.0.2.3 to 192.0.2.1."
ChangeBatch_Change=$change1,$change2,$change3
}

PS C:\> Edit-R53ResourceRecordSet @params
This example creates an A record for www.example.com and changes the A record for test.example.com from 192.0.2.3 to 192.0.2.1.

See the Amazon Route 53 documentation for more details. You can use the Get-R53Change cmdlet to poll to determine when the changes are complete.

Example 2

PS C:\> $change1 = New-Object Amazon.Route53.Model.Change
PS C:\> $change1.Action = "CREATE"
PS C:\> $change1.ResourceRecordSet = New-Object Amazon.Route53.Model.ResourceRecordSet
PS C:\> $change1.ResourceRecordSet.Name = "example.com"
PS C:\> $change1.ResourceRecordSet.Type = "A"
PS C:\> $change1.ResourceRecordSet.AliasTarget = New-Object Amazon.Route53.Model.AliasTarget
PS C:\> $change1.ResourceRecordSet.AliasTarget.HostedZoneId = "Z1111111111111"
PS C:\> $change1.ResourceRecordSet.AliasTarget.DNSName = "example-load-balancer-1111111111.us-east-1.elb.amazonaws.com."
PS C:\> $change1.ResourceRecordSet.AliasTarget.EvaluateTargetHealth = $true

PS C:\> $change2 = New-Object Amazon.Route53.Model.Change
PS C:\> $change2.Action = "CREATE"
PS C:\> $change2.ResourceRecordSet = New-Object Amazon.Route53.Model.ResourceRecordSet
PS C:\> $change1.ResourceRecordSet.Name = "www.example.com"
PS C:\> $change1.ResourceRecordSet.Type = "A"
PS C:\> $change1.ResourceRecordSet.AliasTarget = New-Object Amazon.Route53.Model.AliasTarget
PS C:\> $change1.ResourceRecordSet.AliasTarget.HostedZoneId = "Z1111111111111"
PS C:\> $change1.ResourceRecordSet.AliasTarget.DNSName = "example-load-balancer-1111111111.us-east-1.elb.amazonaws.com."
PS C:\> $change1.ResourceRecordSet.AliasTarget.EvaluateTargetHealth = $false

PS C:\> $params = @{
HostedZoneId="Z222222222"
ChangeBatch_Comment="This change batch creates two alias resource record sets, one for the zone apex, example.com, and one for www.example.com, that both point to example-load-balancer-1111111111.us-east-1.elb.amazonaws.com."
ChangeBatch_Change=$change1,$change2
}

PS C:\> Edit-R53ResourceRecordSet @params
This example shows how to create alias resource record sets. 'Z222222222' is the ID of the Amazon Route 53 hosted zone in which you're creating the alias resource record set. 'example.com' is the zone apex for which you want to create an alias and 'www.example.com' is a subdomain for which you also want to create an alias. 'Z1111111111111' is an example of a hosted zone ID for the load balancer and 'example-load-balancer-1111111111.us-east-1.elb.amazonaws.com' is an example of a load balancer domain name with which Amazon Route 53 responds to queries for example.com and www.example.com.

See the Amazon Route 53 documentation for more details. You can use the Get-R53Change cmdlet to poll to determine when the changes are complete.

Example 3

PS C:\> $change1 = New-Object Amazon.Route53.Model.Change
PS C:\> $change1.Action = "CREATE"
PS C:\> $change1.ResourceRecordSet = New-Object Amazon.Route53.Model.ResourceRecordSet
PS C:\> $change1.ResourceRecordSet.Name = "www.example.com"
PS C:\> $change1.ResourceRecordSet.Type = "A"
PS C:\> $change1.ResourceRecordSet.SetIdentifier = "Rack 2, Positions 4 and 5"
PS C:\> $change1.ResourceRecordSet.Weight = 1
PS C:\> $change1.ResourceRecordSet.TTL = 600
PS C:\> $change1.ResourceRecordSet.ResourceRecords.Add(@{Value="192.0.2.9"})
PS C:\> $change1.ResourceRecordSet.ResourceRecords.Add(@{Value="192.0.2.10"})

PS C:\> $change2 = New-Object Amazon.Route53.Model.Change
PS C:\> $change2.Action = "CREATE"
PS C:\> $change2.ResourceRecordSet = New-Object Amazon.Route53.Model.ResourceRecordSet
PS C:\> $change2.ResourceRecordSet.Name = "www.example.com"
PS C:\> $change2.ResourceRecordSet.Type = "A"
PS C:\> $change2.ResourceRecordSet.SetIdentifier = "Rack 5, Positions 1 and 2"
PS C:\> $change2.ResourceRecordSet.Weight = 3
PS C:\> $change2.ResourceRecordSet.TTL = 600
PS C:\> $change2.ResourceRecordSet.ResourceRecords.Add(@{Value="192.0.2.11"})
PS C:\> $change2.ResourceRecordSet.ResourceRecords.Add(@{Value="192.0.2.12"})

PS C:\> $params = @{
HostedZoneId="Z1PA6795UKMFR9"
ChangeBatch_Comment="This change creates two weighted resource record sets, each of which has two values."
ChangeBatch_Change=$change1,$change2
}

PS C:\> Edit-R53ResourceRecordSet @params
This example creates two A records for www.example.com. One-fourth of the time (1/(1+3)), Amazon Route 53 responds to queries for www.example.com with the two values for the first resource record set (192.0.2.9 and 192.0.2.10). Three-fourths of the time (3/(1+3)) Amazon Route 53 responds to queries for www.example.com with the two values for the second resource record set (192.0.2.11 and 192.0.2.12).

See the Amazon Route 53 documentation for more details. You can use the Get-R53Change cmdlet to poll to determine when the changes are complete.

Example 4

PS C:\> $change1 = New-Object Amazon.Route53.Model.Change
PS C:\> $change1.Action = "CREATE"
PS C:\> $change1.ResourceRecordSet = New-Object Amazon.Route53.Model.ResourceRecordSet
PS C:\> $change1.ResourceRecordSet.Name = "example.com"
PS C:\> $change1.ResourceRecordSet.Type = "A"
PS C:\> $change1.ResourceRecordSet.SetIdentifier = "1"
PS C:\> $change1.ResourceRecordSet.Weight = 3
PS C:\> $change1.ResourceRecordSet.AliasTarget = New-Object Amazon.Route53.Model.AliasTarget
PS C:\> $change1.ResourceRecordSet.AliasTarget.HostedZoneId = "Z1111111111111"
PS C:\> $change1.ResourceRecordSet.AliasTarget.DNSName = "example-load-balancer-2222222222.us-east-1.elb.amazonaws.com."
PS C:\> $change1.ResourceRecordSet.AliasTarget.EvaluateTargetHealth = $true

PS C:\> $change2 = New-Object Amazon.Route53.Model.Change
PS C:\> $change2.Action = "CREATE"
PS C:\> $change2.ResourceRecordSet = New-Object Amazon.Route53.Model.ResourceRecordSet
PS C:\> $change2.ResourceRecordSet.Name = "example.com"
PS C:\> $change2.ResourceRecordSet.Type = "A"
PS C:\> $change2.ResourceRecordSet.SetIdentifier = "2"
PS C:\> $change2.ResourceRecordSet.Weight = 1
PS C:\> $change2.ResourceRecordSet.AliasTarget = New-Object Amazon.Route53.Model.AliasTarget
PS C:\> $change2.ResourceRecordSet.AliasTarget.HostedZoneId = "Z3333333333333"
PS C:\> $change2.ResourceRecordSet.AliasTarget.DNSName = "example-load-balancer-4444444444.us-east-1.elb.amazonaws.com."
PS C:\> $change2.ResourceRecordSet.AliasTarget.EvaluateTargetHealth = $false

PS C:\> $params = @{
HostedZoneId="Z5555555555"
ChangeBatch_Comment="This change batch creates two weighted alias resource record sets. Amazon Route 53 responds to queries for example.com with the first ELB domain 3/4ths of the times and the second one 1/4th of the time."
ChangeBatch_Change=$change1,$change2
}

PS C:\> Edit-R53ResourceRecordSet @params
This example shows how to create weighted alias resource record sets assuming that example.com is the domain for which you want to create weighted alias resource record sets. SetIdentifier differentiates the two weighted alias resource record sets from one another. This element is required because the Name and Type elements have the same values for both resource record sets. Z1111111111111 and Z3333333333333 are examples of hosted zone IDs for the ELB load balancer specified by the value of DNSName. example-load-balancer-2222222222.us-east-1.elb.amazonaws.com and example-load-balancer-4444444444.us-east-1.elb.amazonaws.com are examples of Elastic Load Balancing domains from which Amazon Route 53 responds to queries for example.com.

See the Amazon Route 53 documentation for more details. You can use the Get-R53Change cmdlet to poll to determine when the changes are complete.

Example 5

PS C:\> $change1 = New-Object Amazon.Route53.Model.Change
PS C:\> $change1.Action = "CREATE"
PS C:\> $change1.ResourceRecordSet = New-Object Amazon.Route53.Model.ResourceRecordSet
PS C:\> $change1.ResourceRecordSet.Name = "example.com"
PS C:\> $change1.ResourceRecordSet.Type = "A"
PS C:\> $change1.ResourceRecordSet.SetIdentifier = "Oregon load balancer 1"
PS C:\> $change1.ResourceRecordSet.Region = us-west-2
PS C:\> $change1.ResourceRecordSet.AliasTarget = New-Object Amazon.Route53.Model.AliasTarget
PS C:\> $change1.ResourceRecordSet.AliasTarget.HostedZoneId = "Z1111111111111"
PS C:\> $change1.ResourceRecordSet.AliasTarget.DNSName = "example-load-balancer-2222222222.us-west-2.elb.amazonaws.com"
PS C:\> $change1.ResourceRecordSet.AliasTarget.EvaluateTargetHealth = $true

PS C:\> $change2 = New-Object Amazon.Route53.Model.Change
PS C:\> $change2.Action = "CREATE"
PS C:\> $change2.ResourceRecordSet = New-Object Amazon.Route53.Model.ResourceRecordSet
PS C:\> $change2.ResourceRecordSet.Name = "example.com"
PS C:\> $change2.ResourceRecordSet.Type = "A"
PS C:\> $change2.ResourceRecordSet.SetIdentifier = "Singapore load balancer 1"
PS C:\> $change2.ResourceRecordSet.Region = ap-southeast-1
PS C:\> $change2.ResourceRecordSet.AliasTarget = New-Object Amazon.Route53.Model.AliasTarget
PS C:\> $change2.ResourceRecordSet.AliasTarget.HostedZoneId = "Z2222222222222"
PS C:\> $change2.ResourceRecordSet.AliasTarget.DNSName = "example-load-balancer-1111111111.ap-southeast-1.elb.amazonaws.com"
PS C:\> $change2.ResourceRecordSet.AliasTarget.EvaluateTargetHealth = $true

PS C:\> $params = @{
HostedZoneId="Z5555555555"
ChangeBatch_Comment="This change batch creates two latency resource record sets, one for the US West (Oregon) region and one for the Asia Pacific (Singapore) region."
ChangeBatch_Change=$change1,$change2
}

PS C:\> Edit-R53ResourceRecordSet @params
This example creates two latency alias resource record sets, one for an ELB load balancer in the US West (Oregon) region (us-west-2), and another for a load balancer in the Asia Pacific (Singapore) region (ap-southeast-1).

See the Amazon Route 53 documentation for more details. You can use the Get-R53Change cmdlet to poll to determine when the changes are complete.

Supported Version

AWS Tools for PowerShell: 2.x.y.z