简体   繁体   English

Route53 - 创建 TXT 类型 dns 记录时出错 (powershell)

[英]Route53 - Error while creating TXT type dns record (powershell)

I'm using Powershell to create a TXT record using sample code from AWS documentation我正在使用 Powershell 使用 AWS 文档中的示例代码创建 TXT 记录

$change = New-Object Amazon.Route53.Model.Change
$change.Action = "CREATE"
$change.ResourceRecordSet = New-Object Amazon.Route53.Model.ResourceRecordSet
$change.ResourceRecordSet.Name = "<domain name provided>"
$change.ResourceRecordSet.Type = "TXT"
$change.ResourceRecordSet.TTL = 600
$change.ResourceRecordSet.ResourceRecords.Add(@{Value="item 1 item 2 item 3"})

$params = @{
HostedZoneId="<Zone ID provided>"
ChangeBatch_Comment="Test"
ChangeBatch_Change=$change
}

Edit-R53ResourceRecordSet @params

Above code gives the error - "Edit-R53ResourceRecordSet: [Invalid Resource Record: 'FATAL problem: InvalidCharacterString (Value should be enclosed in quotation marks) encountered with 'item 1 item 2 item 3'']"上面的代码给出了错误 - “Edit-R53ResourceRecordSet: [Invalid Resource Record: 'FATAL problem: InvalidCharacterString (Value should be encused in quotation marks) encountered with 'item 1 item 2 item 3'']”

If I try to create an A type record with an IP (Value=IP address) with the same code, it works fine.如果我尝试使用相同的代码创建一个带有 IP(值 = IP 地址)的 A 类型记录,它工作正常。

The documentation seems to indicate you need inline quotation marks around each record value, so you'll want to do something like:文档似乎表明您需要在每个记录值周围加上内联引号,因此您需要执行以下操作:

$change.ResourceRecordSet.ResourceRecords.Add(@{Value='"item 1 item 2 item 3"'})

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM