谷歌云dns CNAME创建示例

Lor*_*nzo 2 dns google-cloud-dns

我无法为特定托管区域创建新的 CNAME。

我可以看到 A 和 TXT 条目的示例,例如:

$ gcloud dns record-sets transaction add -z MANAGED_ZONE \
            --name my.domain. --ttl 1234 --type A "1.2.3.4"

$ gcloud dns record-sets transaction add -z MANAGED_ZONE \
            --name my.domain. --ttl 2345 --type TXT "Hello world" "Bye \
            world"
Run Code Online (Sandbox Code Playgroud)

但我总是收到参数太少的错误。目前我正在发布:

$ gcloud dns record-sets -z=MYZONE transaction add\
            --name="NAME" --type=CNAME --ttl 3600 --rrdatas="DEST"
Run Code Online (Sandbox Code Playgroud)

我猜这个问题与 rrdatas 字段有关,但我找不到任何文档。

mim*_*ing 5

该命令没有标志rrdatas。您可以将所需的值rrdatas作为位置参数放在命令末尾。另请注意,-z应在所有命令之后提供区域标志。所以:

$ gcloud dns record-sets -z=MYZONE transaction add --type=CNAME \
  --name="www.example.com." --ttl 3600 --rrdatas="target.example.com."
Run Code Online (Sandbox Code Playgroud)

应该改为这样:

$ gcloud dns record-sets transaction add -z=MYZONE --type=CNAME \
  --name="www.example.com." --ttl 3600 "target.example.com."
Run Code Online (Sandbox Code Playgroud)