Error when trying to attach static IP to instance

2,956 views
Skip to first unread message

Colin McDonnell

unread,
Feb 14, 2017, 9:14:01 AM2/14/17
to gce-discussion
Hi,

I'm trying to attach a static IP to an instances and getting a strange error. 

Here's the command I'm running:

gcloud compute instances add-access-config $INSTANCE_NAME --access-config-name $INSTANCE_NAME-config --address 35.185.62.12


I get back this error:

ERROR: (gcloud.compute.instances.add-access-config) Some requests did not succeed:

 - Invalid value for field 'resource.natIP': '35.185.62.12'. The specified external IP address '35.185.62.12' was not found in region 'us-east1'.


Yet when I run:

gcloud compute instances add-access-config $INSTANCE_NAME --access-config-name $INSTANCE_NAME-config --address 35.185.62.12


I get this:

NAME        REGION    ADDRESS        STATUS

lor-addr-1  us-east1  35.185.62.124  RESERVED

Colin McDonnell

unread,
Feb 14, 2017, 3:28:02 PM2/14/17
to gce-discussion
[EDIT]

That second command should read:

gcloud compute addresses list

Sorry about that.

Colin

Faizan (Google Cloud Support)

unread,
Feb 14, 2017, 6:40:07 PM2/14/17
to gce-discussion
Hello Colin,

Can you assign the static IP through Cloud Console to see if it works? 

You can also try to delete the existing access configuration first before reassigning a new configuration. You can use the following commands:

gcloud compute instances delete-access-config [INSTANCE_NAME] --access-config-name [ACCESS_CONFIG_NAME]`

gcloud compute instances add-access-config [INSTANCE_NAME] --access-config-name [ACCESS_CONFIG_NAME] --address [IP_ADDRESS]

For more information you can refer to this link. I hope that helps.

Faizan

Colin McDonnell

unread,
Feb 14, 2017, 6:53:24 PM2/14/17
to gce-discussion
Hi Faizan,

Thanks for the info. Turns out it was a simple typo -- I miscopied the IP address and left off the last character. The error about the region threw me off.

Colin

Faizan (Google Cloud Support)

unread,
Feb 14, 2017, 7:26:06 PM2/14/17
to gce-dis...@googlegroups.com
Glad to know this is resolved.

Faizan
Reply all
Reply to author
Forward
0 new messages