I'm experiencing strange behavior during instance creation on Google Compute Engine.
When I try to create and start ubuntu-1410-utopic
instance all is working as expected but if I try to create instance ubuntu-1404-trusty
I get exception:
java.util.concurrent.ExecutionException: org.jclouds.http.HttpResponseException: command: POST https://www.googleapis.com/compute/v1/projects/myProjectName/zones/asia-east1-a/instances HTTP/1.1 failed with response: HTTP/1.1 400 BadRequest; content:
[{
"error": {
"errors": [
{
"domain": "global",
"reason": "invalid",
"message": "Invalid value for field 'resource.name': '615aa438-ef50-4c19-850b-e483a294d944-955'. Must be a match of regex '(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?)'"
}
],
"code": 400,
"message": "Invalid value for field 'resource.name': '615aa438-ef50-4c19-850b-e483a294d944-955'. Must be a match of regex '(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?)'"
}
}]
Why does this happens, and what is resource.name
?
UPDATE
I found the answer, see answers sections.
The reason was dead simple. You can't create new instance on GCE if it's name starts with a digit. Use letters instead.
I had some random UUID as a name (615aa438-ef50-4c19-850b-e483a294d944
in example above) and jclouds
added some suffix (-955
here).