Last active
January 23, 2018 00:02
-
-
Save jamesmoey/678a1ee101bd03df9f05f04a50a44ef1 to your computer and use it in GitHub Desktop.
Create DNS Record On Google Cloud Compute Engine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
IP=$(curl http://metadata/computeMetadata/v1/instance/network-interfaces/0/access-configs/0/external-ip -H "Metadata-Flavor: Google") | |
gcloud dns record-sets transaction start -z=$1 | |
gcloud dns record-sets transaction remove -z=$1 --name=$2 --type=A --ttl=3600 | |
gcloud dns record-sets transaction add -z=$1 --name=$2 --type=A --ttl=3600 $IP | |
gcloud dns record-sets transaction execute -z=$1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment