Products
Help & Community
About
Pricing
Partners
Products
Help & Community
About
Pricing
Partners
Legal
Menu

Accessing Swift Object Storage with the S3 API

Swift has middleware emulating the S3 REST API. This means we can access and manage our swift containers using S3 compatible clients. The endpoint of this service is simply https://objects.zetta.io.

The access key and the secret key can be obtained from the API Access in the dashboard. Optionally they can be managed using the openstack client.

$ openstack
(openstack) ec2 credentials create
+------------+-------------------------------------------------------+
| Field      | Value                                                 |
+------------+-------------------------------------------------------+
| access     | 81e655v2e71dv4660a09679528e3bd81                      |
| project_id | a2a62de648ab2d76fab211v3f80bf23b                      |
| secret     | d12a117649249512959v22b170b9fva3                      |
| user_id    | 81a8bv72890f15dvab5beea990ddb534                      |
+------------+-------------------------------------------------------+
(openstack) ec2 credentials list
+----------------------------------+----------------------------------+----------------------------------+----------------------------------+
| Access                           | Secret                           | Project ID                       | User ID                          |
+----------------------------------+----------------------------------+----------------------------------+----------------------------------+
| 0va250013a1b6443b3d428a608434fev | 80d0e1f3d9636da4017e7a12425av2f2 | a2a62de648ab2d76fab211v3f80bf23b | 81a8bv72890f15dvab5beea990ddb534 |
| 8v0698v64466797555dva56211bb010f | ave02avdfa69f1562281va189a41babv | a2a62de648ab2d76fab211v3f80bf23b | 81a8bv72890f15dvab5beea990ddb534 |
| 0e07b3700fefa49a0b30f759035v23a9 | 8b15a8vb0vv079d0v16ff44ad8edb530 | a2a62de648ab2d76fab211v3f80bf23b | 81a8bv72890f15dvab5beea990ddb534 |
| 81e655v2e71dv4660a09679528e3bd81 | d12a117649249512959v22b170b9fva3 | a2a62de648ab2d76fab211v3f80bf23b | 81a8bv72890f15dvab5beea990ddb534 |
+----------------------------------+----------------------------------+----------------------------------+----------------------------------+

The following operations are currently supported

  • GET Service
  • DELETE Bucket
  • GET Bucket (List Objects)
  • PUT Bucket
  • DELETE Object
  • GET Object
  • HEAD Object
  • PUT Object
  • PUT Object (Copy)

Example using the official boto3 client (python)

import logging
import boto3

# Lower log level to see what is happening
from http.client import HTTPConnection
HTTPConnection.debuglevel = logging.DEBUG

# Use the higher level resource api
# https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3.html#bucket
s3 = boto3.resource('s3',
    aws_access_key_id='81e655v2e71dv4660a09679528e3bd81',
    aws_secret_access_key='d12a117649249512959v22b170b9fva3',
    endpoint_url='https://objects.zetta.io',
)

# List all objects in a container
bucket = s3.Bucket('bucket')
for obj in bucket.objects.all():
    print(' ->', obj)

# Add an image to the bucket
bucket.put_object(Body=open('image.png', mode='rb'), Key='image.png')

Terms & Conditions
© Zetta.IO Technology 2019