Creating containers

A container can be thought of as a root folder under our OpenStack Object Storage. It allows for objects to be stored within it. Creating objects and containers can be achieved in a number of ways. A simple way is by using the swift client tool.

Getting ready

Ensure you are logged in to a Ubuntu host that has access to our OpenStack environment on the 192.168.100.0/24 public network. This host will be used to run client tools against the OpenStack environment created. If you are using the accompanying Vagrant environment, you can use the controller node. This node has the python-swiftclient package that provides the swift command-line client.

If you created this node with Vagrant, you can execute the following command:

vagrant ssh controller 

Ensure you have set the following credentials (adjust the path to your certificates and key file to match your environment if not using the Vagrant environment):

export OS_TENANT_NAME=cookbook
export OS_USERNAME=admin
export OS_PASSWORD=openstack
export OS_AUTH_URL=https://192.168.100.200:5000/v2.0/
export OS_NO_CACHE=1
export OS_KEY=/vagrant/cakey.pem
export OS_CACERT=/vagrant/ca.pem

How to do it...

Carry out the following steps to create a container under OpenStack Object Storage:

  1. To create a container named test under our OpenStack Object Storage server using the swift tool, we use the following command:
    swift post test
    
  2. We can verify the creation of our container by listing the containers in our OpenStack Object Storage environment. To list containers, execute the following command:
    swift list test
    

    This will simply list the containers in our OpenStack Object Storage environment, as shown in the following section:

How it works...

Creation of containers using the supplied swift tool is very simple. The syntax uses the post parameter for this purpose:

swift post container_name 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset