2.1.2.1. Create server

 
MethodURIDescription
POST/v2/{tenant_id}/servers​{?security_group,​user_data,​availability_zone}

Creates a server.

Normal response codes: 202

Error response codes: computeFault (400, 500, ), UnprocessableEntity (422), serviceUnavailable (503), badRequest (400), unauthorized (401), forbidden (403), badMethod (405), overLimit (413), itemNotFound (404), badMediaType (415), serverCapacityUnavailable (503)

 2.1.2.1.1. Request

This table shows the URI parameters for the create server request:

NameTypeDescription

{tenant_id}

​U​U​ID

The tenant ID in a multi-tenancy cloud.

This table shows the query parameters for the create server request:

NameTypeDescription

security_group

​String

(Required)

The name of the security group. If blank, the server is created in the default security group.

user_data

​String

(Optional)

Configuration information or scripts to use upon launch. Must be Base64 encoded.

availability_zone

​String

(Optional)

The availability zone in which to launch the server.

 

Example 2.3. Create server: JSON request

{
   "server":{
      "name":"server-test-1",
      "imageRef":"b5660a6e-4b46-4be3-9707-6b47221b454f",
      "flavorRef":"2",
      "max_count":1,
      "min_count":1,
      "networks":[
         {
            "uuid":"d32019d3-bc6e-4319-9c1d-6722fc136a22"
         }
      ]
   }
}

 

Example 2.4. Create server: XML request

<?xml version='1.0' encoding='UTF-8'?>
<server xmlns="http://docs.openstack.org/compute/api/v1.1"
  imageRef="b5660a6e-4b46-4be3-9707-6b47221b454f" flavorRef="2"
  name="server-test-2">
  <metadata>
    <meta key="My Server Name">API Test Server XML</meta>
  </metadata>
  <personality>
    <file path="/etc/banner.txt">
      ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBp
      dCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5k
      IGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVs
      c2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4g
      QnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRo
      ZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlv
      dSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vy
      c2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6
      b25zLiINCg0KLVJpY2hhcmQgQmFjaA==</file>
  </personality>
  <networks>
    <network uuid="0ef47ac7-6797-4e01-8a47-ed26ec3aaa56"/>
  </networks>
</server>

 2.1.2.1.2. Response
 

Example 2.5. Create server: JSON response

{
   "server":{
      "security_groups":[
         {
            "name":"default"
         }
      ],
      "OS-DCF:diskConfig":"MANUAL",
      "id":"c6d04159-9bfc-4ab8-823d-0d5ca2abe152",
      "links":[
         {
            "href":"http://166.78.46.130:8774/v2/4fd44f30292945e481c7b8a0c8908869/servers/c6d04159-9bfc-4ab8-823d-0d5ca2abe152",
            "rel":"self"
         },
         {
            "href":"http://166.78.46.130:8774/4fd44f30292945e481c7b8a0c8908869/servers/c6d04159-9bfc-4ab8-823d-0d5ca2abe152",
            "rel":"bookmark"
         }
      ],
      "adminPass":"aabbccddeeff"
   }
}

 

Example 2.6. Create server: XML response

<?xml version='1.0' encoding='UTF-8'?>
<server
  xmlns:OS-DCF="http://docs.openstack.org/compute/ext/disk_config/api/v1.1"
  xmlns:atom="http://www.w3.org/2005/Atom"
  xmlns="http://docs.openstack.org/compute/api/v1.1"
  id="9720d338-07fb-4317-9eda-a0a833226afa" adminPass="aabbccddeeff"
  OS-DCF:diskConfig="MANUAL">
  <metadata/>
  <atom:link
    href="http://166.78.46.130:8774/v2/4fd44f30292945e481c7b8a0c8908869/servers/9720d338-07fb-4317-9eda-a0a833226afa"
    rel="self"/>
  <atom:link
    href="http://166.78.46.130:8774/4fd44f30292945e481c7b8a0c8908869/servers/9720d338-07fb-4317-9eda-a0a833226afa"
    rel="bookmark"/>
  <security_groups>
    <security_group name="default"/>
  </security_groups>
</server>

Questions? Discuss on ask.openstack.org
Found an error? Report a bug against this page


loading table of contents...