Reputation: 5204
I want to create a google cloud compute instance with a static external ip address. I can do that if I manually do it with the console in the browser.
I have been looking through the documentation, I can't see an argument to create the static external IP address on creation using the CLI tools.
To create instances I have been using gcloud compute instances create --zone us-central1-a --source-instance-template instance-template instance-node-1
How do I attach a static external IP address to it using the CLI so that when I shut it down and restart it, it will have the same IP address?
Upvotes: 1
Views: 1368
Reputation: 969
You can get exactly you want with "--address" flag.
According to Google document, You can create a vm instance with static external IP address like below.
gcloud compute instances create INSTANCE_NAME --address IP_ADDRESS
Refer here to get detailed information.
Upvotes: 3