Google Cloud公共主机名 [英] Google Cloud public hostname

查看:150
本文介绍了Google Cloud公共主机名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有其他解决方案可以像其他云平台一样在Google云中获取公共主机名? 当前的计算机名称为: computername.c.googleprojectid.internal

Is there any solution to get a public hostname in google cloud like in other cloud platforms? Currently the machine name is: computername.c.googleprojectid.internal

但是我想要在Amazon或Azure中类似的东西: computername.cloudapp.net

but I want something like in Amazon or in Azure: computername.cloudapp.net

推荐答案

您可以使用 Google Cloud DNS 服务,用于在启动时为您的主机更新DNS记录. (您也可以使用dyn-dns之类的服务,但我假设您希望在可能的情况下使用Google工具.)看来您想使用,并使用与您的VM关联的服务帐户.看起来像这样:

You can use the Google Cloud DNS service to update the DNS record for your host on startup. (You could also use a service like dyn-dns, but I'm assuming that you want to us the Google tools where possible.) It looks like you'd want to use the "create change" API, using a service account associated with your VM. This would look something like:

POST https://www.googleapis.com/dns/v1beta1/projects/*myProject*/managedZones/*myZone.com*/changes

{
  "additions": [
    {
      "name": "computername.myZone.com.",
      "type": "A",
      "ttl": 600,
      "rrdatas": [
        "200.201.202.203"
      ]
    }
  ],
  "deletions": [
  ],
}

请注意,200.201.202.203必须是您的VM的外部IP地址.

Note that 200.201.202.203 needs to be the external IP address of your VM.

这篇关于Google Cloud公共主机名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆