Recommended by 0 users
A container can be thought of as a root folder under our OpenStack Object Storage. In the OpenStack dashboard, you can only manage containers and objects.
In OpenStack Object Storage, containers provide storage for objects in a manner similar to a Windows folder or Linux file directory, though they cannot be nested. An object in OpenStack consists of the file to be stored in the container and any accompanying metadata.
They allow for objects to be stored within them. Creating objects and containers can be achieved in a number of ways. A simple way is by using the swift client tool. We run this client tool against our OpenStack Identity Service, which in turn has been configured to communicate to our OpenStack Object Storage proxy server and allows us to create, delete, and modify containers and objects in our OpenStack Object Storage environment.
Log into a computer or a server that has the swift client package installed.
How to do it…
Carry out the following steps to create a container under OpenStack Object Storage:
- To create a container named test, under our OpenStack Object Storage server, using the swift tool, we do the following:
swift -V 2.0 -A http://172.16.0.200:5000/v2.0/ \ -U cookbook:demo -K openstack post test
- We can verify the creation of our container by listing the containers in our OpenStack Object Storage environment. To list containers, execute the following:
swift -V 2.0 -A http://172.16.0.200:5000/v2.0/ \ -U cookbook:demo -K openstack list
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 is as follows:
swift -V 2.0 -A http://keystone_server:5000/v2.0 \ -U tenant:user -K password post
This authenticates our user through OpenStack Identity Service using Version 2.0 authentication, which in turn connects to the OpenStack Object Storage endpoint configured for this tenant and executes the required command to create the container.