Google Cloud public hostname

懵懂的女人 提交于 2019-12-23 23:32:06

问题


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

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


回答1:


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": [
  ],
}

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



来源:https://stackoverflow.com/questions/25724351/google-cloud-public-hostname

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!