powershell - 错误解析参数 '--change-batch' : Expected: '=' , received: ' ' for input:

标签 powershell aws-cli amazon-route53

我想更新 CNAME 记录。我收到 Error parsing parameter '--change-batch': Expected: '=', received: ' ' for input: 当我运行下面的 powershell 脚本时。我在 here 中看到类似的错误对于另一个 aws 命令。我确认我正在按照那里的建议使用 file:// 。我还看到另一个post并且我确认我没有前面或后面的双引号或单引号。我能够验证 json 数据并确保该文件存在于同一目录中。我不知道发生了什么事。任何帮助表示赞赏。我的 powershell 脚本如下。

$json = '{"Changes": [{"Action": "UPSERT","ResourceRecordSet": {"Name": "dev.mydns.com","Type": "CNAME","TTL": 300,"ResourceRecords": [{"Value": "s-########1.server.transfer.us-east-1.amazonaws.com."}]}},{"Action": "UPSERT","ResourceRecordSet": {"Name": "qa.mydns.com","Type": "CNAME","TTL": 300,"ResourceRecords": [{"Value": "s-########2.server.transfer.us-east-1.amazonaws.com"}]}},{"Action": "UPSERT","ResourceRecordSet": {"Name": "uat.mydns.com","Type": "CNAME","TTL": 300,"ResourceRecords": [{"Value": "s-########3.server.transfer.us-east-1.amazonaws.com."}]}}]}'
$json | Out-File "route_update.json"

#I was able to get the file content and print using below commands

<#
$jsondata = Get-Content -Raw -Path route_update.json 
Write-Host $jsondata
#>

aws route53 change-resource-record-sets --hosted-zone-id <ZoneId> --change-batch file://route_update.json

最佳答案

如果要使用JSON文件,相对路径(macOS/Linux)的格式为;

--change-batch file://./dnsUpdates.json

关于powershell - 错误解析参数 '--change-batch' : Expected: '=' , received: ' ' for input:,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63493865/

相关文章:

引号中的 Powershell 哈希表

file - 在Powershell脚本中将文件从一个位置复制到另一位置,此外还要检查某些值

amazon-web-services - 使用 CLI 描述 AWS 中的策略

r - 如何使用 AWS CLI 仅复制 S3 存储桶中与给定字符串模式匹配的文件

amazon-web-services - SSL 证书不起作用(AWS Route 53)

powershell - 尝试在 powershell v2.0 中做一个简单的发布请求,没有运气

linux - 无法在 Linux 上的 PowerShell 中创建 Windows 快捷方式

amazon-web-services - 您可以从 CLI 或 API 查询 AWS Amplify 预览版本的部署状态吗?

amazon-web-services - AWS CloudFormation 模板将 IP 地址添加到 Route 53 记录,而不是 URL

amazon-web-services - 如何确保 EC2 实例在停止/启动后仍然存在?