This is a follow up to Ie039322660fd0e2e0403843448379b78114c425b. A few things are changed here: * The note about using file injection is removed. File injection was deprecated in the API in Queens and not something that we really want users using. * Mention that creating a flavor is typically admin-only. * Link to the BDM docs for more details about BDM parameter values. * Update the manage-ip-address docs to make the examples rely on using the networking resource CLIs rather than any proxy APIs that were available in nova. Change-Id: Ifa2e2bbb4c5f51f13d1a5832bd7dbf9f690fcad7
6.9 KiB
Launch an instance from an image
Follow the steps below to launch an instance from an image.
After you gather required parameters, run the following command to launch an instance. Specify the server name, flavor ID, and image ID.
$ openstack server create --flavor FLAVOR_ID --image IMAGE_ID --key-name KEY_NAME \ --user-data USER_DATA_FILE --security-group SEC_GROUP_NAME --property KEY=VALUE \ INSTANCE_NAMEOptionally, you can provide a key name for access control and a security group for security. You can also include metadata key and value pairs. For example, you can add a description for your server by providing the
--property description="My Server"parameter.You can pass user data in a local file at instance launch by using the
--user-data USER-DATA-FILEparameter.Important
If you boot an instance with an INSTANCE_NAME greater than 63 characters, Compute truncates it automatically when turning it into a host name to ensure the correct work of dnsmasq. The corresponding warning is written into the
neutron-dnsmasq.logfile.The following command launches the
MyCirrosServerinstance with them1.smallflavor (ID of1),cirros-0.3.2-x86_64-uecimage (ID of397e713c-b95b-4186-ad46-6126863ea0a9),defaultsecurity group,KeyPair01key, and a user data file calledcloudinit.file:$ openstack server create --flavor 1 --image 397e713c-b95b-4186-ad46-6126863ea0a9 \ --security-group default --key-name KeyPair01 --user-data cloudinit.file \ myCirrosServerDepending on the parameters that you provide, the command returns a list of server properties.
+--------------------------------------+-----------------------------------------------+ | Field | Value | +--------------------------------------+-----------------------------------------------+ | OS-DCF:diskConfig | MANUAL | | OS-EXT-AZ:availability_zone | | | OS-EXT-SRV-ATTR:host | None | | OS-EXT-SRV-ATTR:hypervisor_hostname | None | | OS-EXT-SRV-ATTR:instance_name | | | OS-EXT-STS:power_state | NOSTATE | | OS-EXT-STS:task_state | scheduling | | OS-EXT-STS:vm_state | building | | OS-SRV-USG:launched_at | None | | OS-SRV-USG:terminated_at | None | | accessIPv4 | | | accessIPv6 | | | addresses | | | adminPass | E4Ksozt4Efi8 | | config_drive | | | created | 2016-11-30T14:48:05Z | | flavor | m1.tiny | | hostId | | | id | 89015cc9-bdf1-458a-8518-fdca2b4a5785 | | image | cirros (397e713c-b95b-4186-ad46-6126863ea0a9) | | key_name | KeyPair01 | | name | myCirrosServer | | os-extended-volumes:volumes_attached | [] | | progress | 0 | | project_id | 5669caad86a04256994cdf755df4d3c1 | | properties | | | security_groups | [{u'name': u'default'}] | | status | BUILD | | updated | 2016-11-30T14:48:05Z | | user_id | c36cec73b0e44876a4478b1e6cd749bb | | metadata | {u'KEY': u'VALUE'} | +--------------------------------------+-----------------------------------------------+A status of
BUILDindicates that the instance has started, but is not yet online.A status of
ACTIVEindicates that the instance is active.Copy the server ID value from the
idfield in the output. Use the ID to get server details or to delete your server.Copy the administrative password value from the
adminPassfield. Use the password to log in to your server.Check if the instance is online.
$ openstack server listThe list shows the ID, name, status, and private (and if assigned, public) IP addresses for all instances in the project to which you belong:
+-------------+----------------------+--------+------------+-------------+------------------+------------+ | ID | Name | Status | Task State | Power State | Networks | Image Name | +-------------+----------------------+--------+------------+-------------+------------------+------------+ | 84c6e57d... | myCirrosServer | ACTIVE | None | Running | private=10.0.0.3 | cirros | | 8a99547e... | myInstanceFromVolume | ACTIVE | None | Running | private=10.0.0.4 | centos | +-------------+----------------------+--------+------------+-------------+------------------+------------+If the status for the instance is ACTIVE, the instance is online.
To view the available options for the
openstack server listcommand, run the following command:$ openstack help server listNote
If you did not provide a key pair, security groups, or rules, you can access the instance only from inside the cloud through VNC. Even pinging the instance is not possible.