Skip to main content

A Cubicweb Storage that stores the data on S3

Project description

Summary

A Cubicweb Storage that stores the data on S3.

It is a standard Cubicweb Storage, similar to the BytesFileSystemStorage. For example, if you want to store File.data payloads in S3, you should create an S3Storage instance, typically in a startup hook, as:

from cubicweb.server.hook import Hook
from cubicweb_s3storage.storages import S3Storage

class S3StorageStartupHook(Hook):
    __regid__ = 'mycube.server-startup-hook'
    events = ('server_startup', 'server_maintenance')

    def __call__(self):
        storage = S3Storage('s3_bucket')
        self.repo.system_source.set_storage('File', 'data', storage)

By default, S3 object keys (ie. S3 object identifiers) are random UUID generated at entity creation time. If you want to implement another key generation algorithm, you must write overload S3Storage.new_s3_key() method.

Communications with AWS are handled by boto3.

Configuration

The S3Storage class constructor needs an S3 bucket name.

If you want to put your aws credentials in an other file than the default (~/.aws/credentials), you must set the AWS_CONFIG_FILE environment variable.

If you want to use another profile name than default, set the AWS_PROFILE environment variable.

If you prefer to configure AWS credentials by environment variables (eg. when using docker), you can use the following variables:

  • AWS_ACCESS_KEY_ID: the access key for your AWS account,

  • AWS_SECRET_ACCESS_KEY: the secret key for your AWS account.

Please read boto3 documentation for more details.

Further configuration

In some cases you might want to use compatible S3 storage which is not on AWS.

For this you have the following variables :

  • AWS_S3_ENDPOINT_URL: endpoint url for your alternative S3 storage

This enables the use of a minio server, see their documentation about endpoints.

Note : this type of variable has been requested upstream (and related aws-cli).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cubicweb-s3storage-4.0.1.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

cubicweb_s3storage-4.0.1-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file cubicweb-s3storage-4.0.1.tar.gz.

File metadata

  • Download URL: cubicweb-s3storage-4.0.1.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.1

File hashes

Hashes for cubicweb-s3storage-4.0.1.tar.gz
Algorithm Hash digest
SHA256 264b4514f0b3d1d43162919a27e20d621a49c6d8ad6ff00cf76b7060081f70ef
MD5 aa39b1a1cfa2944d90e0ec8bfbdc0f19
BLAKE2b-256 c2420456ce77766cb62ead1f860e4918f0586eccc5353c2daa89be470472fa19

See more details on using hashes here.

File details

Details for the file cubicweb_s3storage-4.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for cubicweb_s3storage-4.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 db4f3fb453cf8f2fa7a960735ef4de6d5fa21f7ba491011e805418337c28e487
MD5 d75beb124381c2215597f27efc1d4b5a
BLAKE2b-256 1e1875e1421abb27ca58546444dd7930c06065684fa766528c8bbd39b80fa3ea

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page