Cloud storage

This feature requires a premimum subscription to be used. For more details, see Plans and pricing.

Hybiscus supports depositing your generated PDF reports directly with your cloud storage provider of choice:

To enable this feature, you must provide a pre-signed URL that supports the HTTP PUT method within the report JSON definition, as shown in the below example:

{
    "type": "Report",
    "config": {
        "cloud_storage": {
            "s3": "...",
            "google_cloud_storage": "...",
            "azure_blob_storage": "...",
        }
    },
    ...
}

Note When enabling the cloud storage upload feature, the /api/v1/get-report endpoint will not be able to return your report, as it will NOT be saved locally to the server.

You may provide one or all of the links from the supported providers. For AWS and Google Cloud users, the URL required is known as a pre-signed URL. For Azure Blob Storage users, the URL must be constructed manually using an SAS (shared access signature) token. In all cases, the pre-signed URL contains a time limited token that enables Hybiscus to upload the generated PDF to your cloud storage provider.

Generating a pre-signed URL for AWS S3

The following code example in Python will show you how to generate a pre-signed URL to provide Hybiscus with:

import boto3
from botocore.client import Config

s3_client = boto3.client(
    "s3",
    aws_access_key_id="<<ACCESS_KEY_ID>>",
    aws_secret_access_key="<<SECRET_ACCESS_KEY>>",
    region_name="eu-west-2",
)
url = s3_client.generate_presigned_url(
    ClientMethod="put_object",
    Params={"Bucket": "my-bucket", "Key": "report.pdf"},
    ExpiresIn=3600,
)
print(url)

For more details, see the AWS documentation.

Generating a pre-signed URL for Google Cloud Storage

The following code example in Python will show you how to generate a pre-signed URL to provide Hybiscus with:

import os
from datetime import timedelta
from google.cloud import storage

os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "/path/to/credentials.json"

storage_client = storage.Client()
bucket = storage_client.bucket("hybiscus-reports")
blob = bucket.blob("report.pdf")
url = blob.generate_signed_url(
    version="v4",
    method="PUT",
    expiration=timedelta(minutes=5),
    content_type="application/octet-stream",
)
print(url)

For more details, see the Google Cloud documentation.

Generating a pre-signed URL for Azure Blob Storage

The following code example in Python will show you how to generate a pre-signed URL to provide Hybiscus with:

from datetime import datetime, timedelta
from azure.storage.blob import BlobServiceClient
from azure.storage.blob import BlobSasPermissions, generate_blob_sas

account_name = "hybiscus"
container_name = "hybiscus-reports"
blob_name = "report.pdf"
blob_service_client = BlobServiceClient.from_connection_string("<<CONN_STRING>>")
sas_token = generate_blob_sas(
    account_name=account_name,
    container_name=container_name,
    blob_name=blob_name,
    account_key=blob_service_client.get_container_client(
        container_name
    ).credential.account_key,
    permission=BlobSasPermissions(write=True),
    expiry=datetime.datetime.utcnow() + timedelta(minutes=15),
)
url = f"https://{account_name}.blob.core.windows.net/{container_name}/{blob_name}?{sas_token}"
print(url)

For more details, see the Azure Blob Storage documentation.

Missing something?

Hybiscus is continuously improving and adding new features. If you think we are missing a critical feature, please do not hesitate to contact us and offer your feedback at info@hybiscus.dev