Tutorials

S3 compatible object storage in Fuga

Fuga supports Amazon S3 compatible object storage. To access the S3 storage you need an EC2 access key and secret key. These can be obtained using the Openstack CLI or the OpenStack Keystone API (which is beyond the scope of this tutorial). Using the OpenStack CLI you can obtain the keypair using the ec2 credentials command as shown below.

openstack ec2 credentials list
+----------------------------------+----------------------------------+----------------------------------+----------------------------------+
| Access                           | Secret                           | Project ID                       | User ID                          |
+----------------------------------+----------------------------------+----------------------------------+----------------------------------+
| 99999999999999999999999999999999 | 99999999999999999999999999999999 | 99999999999999999999999999999999 | 99999999999999999999999999999999 |
+----------------------------------+----------------------------------+----------------------------------+----------------------------------+

When the list is empty a new keypair can be created using the 'openstack ec2 credentials create' command.

The S3 API can be found at https://object.api.fuga.io. Using the EC2 keypair and S3 URL the S3 object can now be accessed using any S3 client or by using one of the various libraries available. Below is a code example using the boto library in Python.

from boto.s3.key import Key
import boto
import boto.s3.connection

access_key = '99999999999999999999999999999999'
secret_key = '99999999999999999999999999999999'
filename = 'test.txt'

conn = boto.connect_s3(
  aws_access_key_id = access_key,
  aws_secret_access_key = secret_key,
  host = 'object.api.fuga.io',
  port = 443,
  calling_format = boto.s3.connection.OrdinaryCallingFormat(),
  )

bucket = conn.get_bucket('mybucket')

k = Key(bucket)
k.key = filename
k.set_contents_from_filename(filename)
k.make_public()

See also:

Was this article helpful?


Go to the next tutorial

Use Ansible to deploy and setup an instance on OpenStack as a LAMP server

This tutorial describes how to use Ansible to automatically create, deploy and configure an Ubuntu-based OpenStack instance with Apache, MySQL and PHP. Prerequisites For this tutorial you'll need the following: An account on Fuga's OpenStack platform. A Linux machine (either an instance on OpenStack or your local workstation) capable of running ansible. A downloaded copy of your openrc.sh file. The CLI tools installed In this tutorial we'll assume an Ubuntu / Debian derived Linux distribution.
Fuga OpenStack

Code.Build.Deploy

Terms of use