Swift getting started
Overview
Swift is Elastx object storage in OpenStack. Swift provides high availability by utilizing all availability zones and is encrypted at rest. This guide will help you get started with the basics surrounding Swift object storage.
Swift/S3 Compatibility
Swift has an s3 compatible API for applications that don’t natively support the Swift API.
You can find a S3/Swift support matrix here.
To get started with Swift/S3, See our guide here for more information.
Getting started with Swift CLI
To use swift cli you’ll need either an application credential or openstack rc file.
Prerequisites
- python-swiftclient installed.
- Application credential. See here on how to get started with application crendentials.
This is required if your account has enabled MFA. - OpenStack rc. Get your rc file by logging into your project, click on your user at the top right and select OpenStack RC File.
This can only be used if your account does not have MFA.
Swift-cli
Start by sourcing your application credential or openstack rc file.
Creating containers and uploading objects
Start by creating a new container:
$ swift post my_container
Upload a file to your container:
$ swift upload my_container ./file1.txt
List containers and objects
To list all containers in your project:
$ swift list
my_container
my_container2
List all objects from a specific container:
$ swift list my_container
file1.txt
Show statistics of your containers and objects
With the stat option, you can get statistics ranging from specific objects to your entire account. To list statistics of a container:
$ swift stat my_container
Account: AUTH_7bf53f20d4a2523a8045c42ae505acx
Container: my_container
Objects: 1
Bytes: 7
Read ACL:
Write ACL:
Sync To:
Sync Key:
Content-Type: application/json; charset=utf-8
X-Timestamp: 1675242117.33639
Last-Modified: Wed, 01 Feb 2023 09:15:39 GMT
Accept-Ranges: bytes
X-Storage-Policy: hdd3
X-Trans-Id: tx2f1e73d3b29a4aba99c1b-0063da2e2b
X-Openstack-Request-Id: tx2f1e73d3b29a4aba99c1b-0063da2e2b
Connection: close
Download objects
You can download single objects or all objects from a specific container or account.
Download a specific object:
$ swift download my_container file1.txt -o ./file1.txt
Download all objects from a specific container:
$ swift download my_container -D </path/to/directory/>
Download all objects from your account:
Beware: If you have a large amounts of objects, this can take some time.
$ swift download --all -D </path/to/directory/>
Delete containers and objects
WARNING: The delete option will execute immediately without any confirmation. This action is irreversible.
Delete specific object from a specified container.
$ swift delete my_container file1.txt
Delete a container with all of its objects.
$ swift delete my_container
Getting started with Swift in Horizon
With Openstacks Horizon you can get a good overview over your object storage. There are limitations in Swifts functionality when using Horizon, to fully take advantage of Swifts functions we recommend you to use the swift cli.
This guide will show you the basics with using Swift object storage in Horizon.
Create your first container
Navigate to “Project” → “Object Store” → “Containers”
Here you will see all the containers in your object storage.
Choose +Container to create a new container:

Choose a name for your new container:

You will se that a new container has been added, which date it was created and that it is empty.

Upload your first file
To upload your first file, press the up arrow next to +Folder:

Select the the file you want to upload:

Download file
To download a file, select your container and press Download next to the object.

View details of an object
You can view details of an object such as Name, Hash, Content Type, Timestamp and Size.
Select the down arrow next to Download for the object you want to inspect and choose View Details:


Further reading
- For more advanced features, see the official OpenStack documenation
- Rclone has native support for Swift. You can read more about Rclone’s support for Swift here.