Attaching volumes to an instance
Now that we have a usable volume, we can attach it to any instance. We'll do this using the openstack server volume add
command.
Getting ready
To attach a volume to an instance, you will need the following:
- The
openstack
command-line client - An
openrc
file with appropriate credentials for the environment - The name or ID of the volume to attach
- The name or ID of the instance to attach the volume to
For our example, these values are as follows:
- Volume:
cookbook.volume
- Instance:
cookbook.test
How to do it...
Carry out the following steps to attach a volume to an instance using the openstack
client:
- First, let's list running instances to get the ID of our instance:
openstack server list -c Name -c ID -f table
An example showing ...
Get OpenStack Cloud Computing Cookbook - Fourth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.