Create multiple servers

Method URI Description
POST /v2/{tenant_id}/servers Creates one or more servers with an optional reservation ID.

Normal response codes: 202

CAUTION:

  • When an instance created using a Linux image is started or restarted, the sshd settings are initialized, and it may no longer be possible to log in to the instance. Refer to "Reboot server" for details on the required tasks.
  • When the password of the user who registered (imported) the image is changed, the image can no longer be used. When the password of the user who registered (imported) the image is changed, the image can no longer be used.
    • The location of the image following the change of image UUID and user authentication information
    • The image UUID that was registered (imported) following the change of image UUID and user authentication information
  • If the following message is displayed after instance creation as a "message" for the instance whose "status" is "ERROR" or "fault", please re-create an instance according to the procedure described in "Create server 1".

    "Block Device Mapping is Invalid: Volume <Volume uuid> did not finish being

    created even after we waited <Elapsed time (seconds)> seconds or <Volume status confirmation frequency> attempts."

Request

This table shows the URI parameters for the create multiple servers request:

Name Type Description
{tenant_id} String Project ID

This table shows the request body parameters for the create multiple servers request:

Name Type Description
security_group String

(Optional)

One or more security_group objects. Specify the name of the security group in the name attribute. If you omit this attribute, the server is created in the default security group.

Specify a security group for which TCP communication is permitted for the following IP address and port number.

IP address: 169.254.169.254

Port number: 80

If TCP communication is not permitted, the host name (computer name) and administrator password may not be set when creating an instance.

user_data String

(Optional)

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

The main formats that are supported are as follows:

  • Linux:
    • Shell script (begins with #!)
  • Windows:
    • PowerShell (begins with #ps1_sysnative or #ps1_x86)
    • Windows batch (begins with rem cmd)

If Linux, cloud-config files can also be specified, but since verification has not been completed, we recommend using Shell scripts.

availability_zone String

(Optional)

The availability zone in which to launch the server.
server ServerForCreate server.
imageRef String The image reference for the desired image for your server instance.

Specify as an ID or full URL.

flavorRef String The flavor reference for the desired flavor for your server instance.

Specify as an ID or full URL.

key_name String

(Optional)

Assigns the public key of the named keypair to the server.

When not assigning a key pair, do not specify key_name. Specifying "" (null character) for key_name will result in an error.

networks String

(Optional)

A networks object. By default, the server instance is provisioned with all isolated networks for the project. Optionally, you can create one or more NICs on the server. To provision the server instance with a NIC for a network, specify the UUID of the network in the uuid attribute in a networks object.

To provision the server instance with a NIC for an already existing port, specify the port-id in the port attribute in a networks object.

You can specify multiple NICs on the server.

Ensure that the network is specified.

To set the following information for a virtual server, a virtual router must be connected to the network that the virtual server will be connected to.

  • Host name (computer name)
  • Administrator password
  • Authentication key (key pair)
uuid String

(Optional)

To provision the server instance with a NIC for a network, specify the UUID of the network in the uuid attribute in a networks object. Required if you omit the port attribute.

If the network includes multiple subnets, IP addresses will be allocated from any subnet. To allocate an IP address of a specific subnet, create a port in advance, and specify the uuid of that port in port.

port String

(Optional)

To provision the server instance with a NIC for an already existing port, specify the port-id in the port attribute in a networks object. Required if you omit the uuid attribute.
fixed_ip String

(Optional)

A fixed IPv4 address for the NIC.
name String The server name.

This information is also used as the computer name/host name.

If 64 characters or more are specified:

  • Windows:

    The computer name will be the default name set by Windows.

  • Linux:

    The host name will be "host-fixedIpAddressOfEth0".

The string set for the computer name/host name is changed as follows:

  • Spaces ( ) and underscores (_) are replaced with hyphens (-)
  • Uppercase letters are replaced with lowercase letters
  • Symbols other than periods (.) and hyphens (-) are removed
  • Periods (.) are removed from the beginning and end of the string, and strings consisting of hyphens (-) are removed
  • In Windows, if the string contains a period (.) anywhere other than at the beginning or end, then the characters preceding the period (.) will be used for the name.
metadata string

(Optional)

Metadata key and value pairs. The maximum size of the metadata key and value is 255 bytes each.
  • Windows:

    To specify a password of an instance, specify the "admin_pass" key.

    The specified password will be set for users specified in cloudbase-init.

    Check with the image provider regarding users who are specified for cloudbase-init.

    Example setting: "metadata": {"admin_pass": "passwordSetForInstance"}

  • To use the automatic failover feature,

    specify "fcx.autofailover": "true".

    However, instances that satisfy the following conditions are excluded from recovery by the operator. Users must either re-create such instances, or delete them.

    • "fcx.autofailover": "false" has been set, or,
    • the instance is a target of auto scaling, or,
    • the status of the instance is ERROR
block_device_mapping_v2 String Enables booting the server from a volume when additional parameters are given.
device_name String Describes a path to the device for the volume you want to use to boot the server.

Specify this item in /dev/vddeviceName format. /dev/vd is fixed, and for deviceName, specify one or more characters (lowercase only) that are valid as a device name.

Note: When using a number in the device name of the system volume, perform specification using the following format.

"/dev/vd" + one or more alphabetical characters (lowercase only) + number (ensure there are no alphabetical characters between numbers)

Example: /dev/vda0 , /dev/vda1 , etc.

When creating an instance that is allocated multiple volumes, for the boot volume, specify the character with highest priority among the device names of all volumes.

The order of priority is a > b > c > ...

source_type String Describes the volume source type for the volume. Choices are "snapshot", "volume", or "image".
destination_type String Specifies the connection destination ("volume").
delete_on_termination bool

(Optional)

Specifies whether volumes created during the instance creation will be deleted when the instance is deleted.

When "True" is specified, volumes during instance creation will also be deleted when the instance is deleted.

When "False" is specified, the volumes created during instance creation will not be deleted when the instance is deleted.

If not specified, "False" (do not delete) will be used.

The volume where snapshots are collected will not be deleted even if "True" is specified.

boot_index String Specifies the device start order. Specify sequential values, starting from 0. For the boot disk, specify "0".
config_drive String

(Optional)

Only "false" can be specified.
uuid uuid Specifies the UUID of the resource specified for source_type.
volume_size String Specify the volume size in GB.

This item must be specified when "image" is specified for source_type. Specify a value equal to or higher than the min_disk parameter of the image to be used. If the min_disk parameter of the image to be used has not been specified or is "0", check the minimum size with the image provider and specify the value accordingly.

If "volume" was specified for source_type, this item will be ignored even if a value is specified.

If "snapshot" was specified for source_type, and this item is omitted, the volume size of the snapshot collection source will be used.

return_reservation_id String

(Optional)

Set to True to generate a reservation ID for each server. Omit this attribute to create servers without a reservation ID. This extended attribute is enabled when the service provider enables multiple server launch.
min_count String

(Optional)

The minimum number of servers to launch when the service provider enables multiple server launch.

An error will occur if unable to create the specified minimum number of servers. If this item is omitted, the 1 will be used

max_count String

(Optional)

The maximum number of servers to launch when the service provider enables multiple server launch.

The system will try to create the specified number of servers. If this item is omitted, the default value, min_count, will be used

Example. Create multiple servers: JSON request


Creates one or more servers with an optional reservation ID.
{
  "server": {
    "name": "new-server-test",
    "imageRef": "9f033140-ea8c-41fe-a432-e832799aa47f",
    "flavorRef": "1",
    "key_name": "keypair1",
    "metadata": {
      "My Server Name": "Apache1"
    },
    "return_reservation_id": true
  }
}

Creates one or more servers with an optional min count.
{
  "server": {
    "name": "new-server-test",
    "imageRef": "9f033140-ea8c-41fe-a432-e832799aa47f",
    "flavorRef": "08ef25d1-9616-46b6-bad3-3835efccf3a5",
    "metadata": {
      "My Server Name": "Apache1"
    },
    "min_count": 1
  }
}

Creates one or more servers with an optional max count.
{
  "server": {
    "name": "new-server-test",
    "imageRef": "9f033140-ea8c-41fe-a432-e832799aa47f",
    "flavorRef": "08ef25d1-9616-46b6-bad3-3835efccf3a5",
    "metadata": {
      "My Server Name": "Apache1"
    },
    "max_count": 1
  }
}
     

Response

Example. Create multiple servers: JSON response


{
	"server": {
		"adminPass": "wfksH3GTTseP",
		"id": "440cf918-3ee0-4143-b289-f63e1d2000e6",
		"links": [
			{	
				"href": "http://openstack.example.com/v2/openstack/servers/440cf918-3ee0-4143-b289-f63e1d2000e6",
				"rel": "self"
			},
			{
				"href": "http://openstack.example.com/openstack/servers/440cf918-3ee0-4143-b289-f63e1d2000e6",
				"rel": "bookmark"
			}
		]
	}
}
     

Example. Create multiple servers: JSON response


{
	"reservation_id": "r-3fhpjulh"
}