Managing objects in Swift
Swift provides object storage for OpenStack. Here, we create containers and upload objects inside the containers. Remember that a container is a virtual entity for organizing the data better.
How to do it…
- Let's begin with creating a container, as follows:
- name: create an object container os_object: state: present container: backup
- Now let's push a sample object here, as follows:
- name: upload backup.tar to backup container os_object: filename: /opt/backup.tar container: backup name: backup.tar state: present
How it works…
Step 1 will create a container named backup
where we can push any object. This is a very typical use case for storing daily backups of databases.
In step 2, we specify the path of the file we want to upload to the container. We will also supply a container name. The name
parameter should be a name of the key to which the file will be uploaded. This can be a path within the container.
Note
As a side note, we recommend encrypting...