Cellar, a S3-like object storage service

Cellar is S3-compatible online file storage web service. You can use it with your favorite S3 client.

To manually manage the files, you can use s3cmd. You can download a s3cmd configuration file from the add-on configuration page.

Clever Cloud Cellar plans

Cellar storage plans
Storage Price / GB / mo Price / TB / mo
First 1 TB € 0.02 € 20.48
Till 25 TB € 0.015 € 15.36
Till 50 TB € 0.01 € 10.24
Cellar trafic usage plans
Traffic (outbound) Price / GB / mo Price / TB / mo
till 10TB € 0.09 € 92.16
Till 40 TB € 0.07 € 71.68

Creating a bucket

In Cellar, files are stored in buckets. When you create a Cellar addon, no bucket is created yet.

To create a bucket, you can use s3cmd:

    s3cmd mb s3://bucket-name

You can list files

    s3cmd ls s3://bucket-name

You can upload files (--acl-public makes the file readable by everyone).

    s3cmd put --acl-public image.jpg s3://bucket-name

Using a custom domain

If you want to use a custom domain, for example cdn.example.com, you need to create a bucket named exactly like your domain:

    s3cmd mb s3://cdn.example.com

Then, you just have to create a CNAME record on your domain pointing to cellar.services.clever-cloud.com..

S3 signature algorithm

Cellar doesn't support the v4 signature algorithm from S3. Please make sure your client is configured to use the v2 signature algorithm. The s3cmd configuration file provided on the add-on configuration page already has it.

Using AWS SDK

To use cellar from your applications, you can use the AWS SDK. You only need to specify a custom endpoint (eg cellar.services.clever-cloud.com) and to force the use of the version 2 of the request signer.

Node.js

var AWS = require('aws-sdk');

AWS.config.update({accessKeyId: '<cellar_key_id>', secretAccessKey: '<cellar_key_secret>'});
var ep = new AWS.Endpoint('<cellar_host>');
var s3 = new AWS.S3({ endpoint: ep, signatureVersion: 'v2' });

s3.listBuckets(function(err, res) {
  // handle results
});

/* In order to share access to access non-public files via HTTP, you need to get a presigned url for a specific key
 * the example above present a 'getObject' presigned URL. If you want to put a object in the bucket via HTTP,
 * you'll need to use 'putObject' instead.
 * see doc : http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#getSignedUrl-property
 */
s3.getSignedUrl('getObject', {Bucket: '<YouBucket>', Key: '<YourKey>'})

Java

Make sure to use at least version 1.11.232. Older versions don't support Server Name Indication, so if you have SSL certificates errors, check that you're not using an old version.

import com.amazonaws.ClientConfiguration;
import com.amazonaws.HttpMethod;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.services.s3.AmazonS3Client;
import java.net.URL;

public class Main {
    public static void main(String[] argv) {
        ClientConfiguration opts = new ClientConfiguration()
        opts.setSignerOverride("S3SignerType"); // Force the use of V2 signer
        AmazonS3Client s3Client = new AmazonS3Client(new BasicAWSCredentials("<key>", "<secret>"), opts);
        s3Client.setEndpoint("<host>");
        // Use path style access to avoid java-related SNI issues
        S3ClientOptions s3ClientOptions = new S3ClientOptions().withPathStyleAccess(true);
        s3Client.setS3ClientOptions(s3ClientOptions);
        List<> buckets = s3Client.listBuckets();

        // handle results

        /* In order to share access to access non-public files via HTTP, you need to get a presigned url for a specific key
        * the example above present a 'getObject' presigned URL. If you want to put a object in the bucket via HTTP,
        * you'll need to use 'HttpMethod.PUT' instead.
        * see doc : http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/s3/AmazonS3.html#generatePresignedUrl-java.lang.String-java.lang.String-java.util.Date-com.amazonaws.HttpMethod-
        */
        URL presignedUrl = s3Client.generatePresignedUrl("<YourBucket>", "<YourKey>", <expiration date>, HttpMethod.GET);
    }
}

Python

Based on this article on dzone. This has been tested against python 3.6

This script use boto, the old implentation of the aws-sdk in python. Make sure to not use boto3, the API is completely different. For the moment, the host endpoint is cellar.services.clever-cloud.com (but check in the clever cloud console).

from boto.s3.key import Key
from boto.s3.connection import S3Connection
from boto.s3.connection import OrdinaryCallingFormat
apikey='<key>'
secretkey='<secret>'
host='<host>'
cf=OrdinaryCallingFormat()  # This mean that you _can't_ use upper case name
conn=S3Connection(aws_access_key_id=apikey, aws_secret_access_key=secretkey, host=host, calling_format=cf)
b = conn.get_all_buckets()
print(b)

"""
In order to share access to non-public files via HTTP, you need to get a presigned url for a specific key
the example above present a 'getObject' presigned URL. If you want to put a object in the bucket via HTTP,
you'll need to use 'putObject' instead.
see doc : http://docs.pythonboto.org/en/latest/ref/s3.html#boto.s3.bucket.Bucket.generate_url
"""
b[0].generate_url(60)
Edit me on GitHub