List instances, notice status of instance |
$ nova list
|
List images |
$ nova image-list
|
List flavors |
$ nova flavor-list
|
Boot an instance using flavor and image names (if names are unique) |
$ nova boot --image IMAGE --flavor FLAVOR INSTANCE_NAME
$ nova boot --image cirros-0.3.1-x86_64-uec --flavor m1.tiny \
MyFirstInstance
|
Login to instance |
# ip netns
# ip netns exec NETNS_NAME ssh USER@SERVER
# ip netns exec qdhcp-6021a3b4-8587-4f9c-8064-0103885dfba2 \
ssh cirros@10.0.0.2
Note, in CirrOS the password for user
cirros is "cubswin:)" without the
quotes.
|
Show details of instance |
$ nova show NAME
$ nova show MyFirstInstance
|
View console log of instance |
$ nova console-log MyFirstInstance
|
Set metadata on an instance |
$ nova meta volumeTwoImage set newmeta='my meta data'
|
Create an instance snapshot |
$ nova image-create volumeTwoImage snapshotOfVolumeImage
$ nova image-show snapshotOfVolumeImage
|
Pause, suspend, stop, rescue, resize, rebuild, reboot an instance |
Pause |
$ nova pause NAME
$ nova pause volumeTwoImage
|
Unpause |
$ nova unpause NAME
|
Suspend |
$ nova suspend NAME
|
Unsuspend |
$ nova resume NAME
|
Stop |
$ nova stop NAME
|
Start |
$ nova start NAME
|
Rescue |
$ nova rescue NAME
$ nova rescue NAME --rescue_image_ref RESCUE_IMAGE
|
Resize |
$ nova resize NAME FLAVOR
$ nova resize my-pem-server m1.small
$ nova resize-confirm my-pem-server1
|
Rebuild |
$ nova rebuild NAME IMAGE
$ nova rebuild newtinny cirros-qcow2
|
Reboot |
$ nova reboot NAME
$ nova reboot newtinny
|
Inject user data and files into an instance |
$ nova boot --user-data FILE INSTANCE
$ nova boot --user-data userdata.txt --image cirros-qcow2 \
--flavor m1.tiny MyUserdataInstance2
To validate that the file is there, ssh into the
instance, and look in /var/lib/cloud
for the file.
|
Inject a keypair into an instance and access
the instance with that keypair |
Create keypair |
$ nova keypair-add test > test.pem
$ chmod 600 test.pem
|
Boot |
$ nova boot --image cirros-0.3.0-x86_64 --flavor m1.small \
--key_name test MyFirstServer
|
Use ssh to connect to the instance |
# ip netns exec qdhcp-98f09f1e-64c4-4301-a897-5067ee6d544f \
ssh -i test.pem cirros@10.0.0.4
|
Manage security groups |
Add rules to default security group allowing ping and
SSH between instances in the default security group |
$ nova secgroup-add-group-rule default default icmp -1 -1
$ nova secgroup-add-group-rule default default tcp 22 22 |