如GCP 文档中所述:
您可以使用 gcloud CLI 或 Cloud 配置别名记录 DNS API。您无法使用 Google Cloud 配置别名记录 控制台。
网上没有如何执行此操作的示例,因此我尝试了以下方法:
gcloud dns --project=my-project record-sets update .example.com. --type="ALIAS" --zone="example-com" --rrdatas="another.website.net." --ttl="300"
但是出现错误:
ERROR: gcloud crashed (UnknownRdatatype): DNS resource record type is unknown.
你可能想尝试使用这个:
gcloud dns record-sets update .example.com. --type=A --name=. --zone="example-com" --rrdatas="another.website.net." --ttl="300"
对于 Cloud DNS 中的别名记录,
--type
标志应设置为 "A"
,而不是 "ALIAS"
。这是 GCP 中记录的行为。