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-1.1.0.tar.gz (11.3 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

cubicweb_s3storage-1.1.0-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

cubicweb_s3storage-1.1.0-py2-none-any.whl (9.8 kB view details)

Uploaded Python 2

File details

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

File metadata

  • Download URL: cubicweb-s3storage-1.1.0.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.1

File hashes

Hashes for cubicweb-s3storage-1.1.0.tar.gz
Algorithm Hash digest
SHA256 d1b514b3bb57434150f9f8c9d0ea12e59021ad1548da76ae3b7277dca5a298e2
MD5 554094b4fb4fe90e854a47feb844f0c0
BLAKE2b-256 a91669ae5773cecfdd8dce04e2b7a51844f74a35618f4b244113097b3c53e10b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cubicweb_s3storage-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.1

File hashes

Hashes for cubicweb_s3storage-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fdfc1b47f57baa24a4835fc35cdb2aba1da8bfe50a1a9adea44772e06454fd40
MD5 83855464e335a8b81b47969adc6e9754
BLAKE2b-256 3af6f1c597e481659e000513c8f82c0f38322c4ca627140d58b2538b501f5f31

See more details on using hashes here.

File details

Details for the file cubicweb_s3storage-1.1.0-py2-none-any.whl.

File metadata

  • Download URL: cubicweb_s3storage-1.1.0-py2-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.1

File hashes

Hashes for cubicweb_s3storage-1.1.0-py2-none-any.whl
Algorithm Hash digest
SHA256 550cee5ad4d668b3d89ca262b541bc890adc4707ce7994637df314a7c3442235
MD5 047c19dfa73d1e77207655a3c8cfcb34
BLAKE2b-256 fb09322a67b6b5d16f2c0a6cf6be9a4d0dda699272a4223263ee3d8166053948

See more details on using hashes here.

Supported by

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