Publishing and Managing Volumes in S3

In this tutorial, we are going to show you how to publish a volume as an S3 bucket, create a user, login as a user, create an access key, configure s3cmd and access a volume, and lastly, upload an object and edit the object as a file.

1

First, go ahead and create a volume.

  • Click on the “Volumes” tab and then select the Volume dropdown menu, and click “Create volume…”

  • Give it a name and then click on “Create.”

  • Now, select the 3 dots next to the name of your volume, and a dropdown menu will show up. Select “Publish volume as S3 bucket…” and assign a name to it.

  • Now your volume has an S3 tag

2

Now go to your terminal and cd into the volume you just created:

cd object-volume/
3

Create a text file using vi:
vi file.txt

  • You can write the following in it: “Hello World, I’m a file!” and save it.

4

Now, open a new tab in your terminal and ssh into a second client:


5

We need to configure the s3cmd which will allow you to manage your S3 objects. First, install the s3cmd with the following line of code:

sudo yum install -y s3cmd
6

To configure the s3cmd, run the following command:

s3cmd --configure
7

At this point, you will be asked to enter your Access Key. In order to obtain an access key, first you need to create a new user in the Quobyte console.

  • Click on the “Configuration tab”

  • Then, under SECURITY, go to the “User Directory” section.

  • Click on the “User” dropdown menu, and select “Add built-in database user…”

  • Enter a username, email address, and password.

  • Then, click on [add] “Tenant membership” and choose “My Tenant...”

  • Next, click on [add] “primary group” and just type “users”

  • Lastly, click on the button ADD
8

Click on the three dots next to the name of the new user you just created, and a dropdown menu will appear.

  • Select “Create access key…”

  • In the “Create Access Key” box, you can leave the “Expires on” field empty, and click the “Create New Access Key” button:

  • Now you should have your access key.

9

Copy the “Access key ID” and enter it in your terminal.


10

You will also be asked to provide a secret key. Go back to your Quobyte web console and copy the “Secret access key” and enter it in the terminal.


11

You can leave the “Default Region [US]:” empty.

12

Now you will be asked to provide an “S3 Endpoint.”

  • To retrieve this S3 endpoint, go to your Quobyte web console and in the “Configuration” tab, under SYSTEM, click on “S3”.

  • Copy the hostname provided by Quobyte

13

Now, to access a bucket you need to use “%(bucket)s.” followed the target S3, i.e., the S3 endpoint you used in the previous step.

%(bucket)s.s3.example_target.myquobyte.net
14

You can just skip the “Encryption password” and “Path to GPG program” by pressing the enter key.

15

When asked if you want to “Use HTTPS protocol [Yes]” type “No.”

16

You can skip the HTTP Proxy server name by pressing enter.

17

Answer with “Y” when asked to “Test access with supplied credentials [Y/n].”


18

Next, save your settings by answering with “y” to the last question.


19

You can now check the buckets available:

s3cmd ls s3://
20

You can check what is actually in the “object-volume” bucket:

s3cmd ls s3://object-volume
21

You can download the file as an object:

s3cmd get s3://object-volume/file.txt
22

Let’s edit the object using vi:

vi file.txt
  • Add the following text to it: "And also an object!” Then save it:
23

To upload the object, run the following command:

s3cmd put file.txt s3://test/file.txt
24

Go back to the first client and do an “ls” to make sure the file is still there.

25

And now, let’s inspect the file to see what has happened:

cat file.txt

As you can see, with Quobyte’s unified namespace, a file can be both a file and an object.