Extended S3 connector

The Hybrid Assets module lets you transfer content to external S3 storage and return hybrid asset content to be stored in Magnolia.

Prerequisites

  • Magnolia 6.2

  • AWS credentials with:

    • AWS access key ID

    • AWS secret access key

    • A public bucket (if you want the versioning function, you need a enabled bucket versioning).

  • A light module in your Magnolia instance for decorations

Step 1: Configure AWS credentials

Please follow the steps from Configuration the AWS connection.

Step 2: Update config.yaml for Hybrid Assets

In your light module, create or edit /modules/hybrid-assets/config.yaml to reference the credentials and configure the S3 store and reference factory.

For a full list of properties for S3, see S3 external content store.

displayPdfAndVideoPreview: false
referenceFactory: (1)
  class: info.magnolia.dam.hybrid.mapping.SimpleReferenceFactory
  mappings:
    referenceS3:
      class: info.magnolia.dam.hybrid.mapping.TransformReferenceMapping
      referenceTemplate: s3://CONFIGUREBUCKET/${baseName}-${nodeId}-${timestamp}.${extension} (2)
      voters: (3)
        mgnlDam:
          class: info.magnolia.dam.hybrid.voters.NodeWorkspaceVoter
stores:
  storeS3: (4)
    class: info.magnolia.dam.hybrid.store.S3AssetStore
    description: S3 asset store
    enabled: true (5)
1 The referenceFactory defines how Azure assets are referenced in Magnolia using a referenceTemplate.
2 The referenceTemplate specifies the storage URL format for assets.

Ensure the referenceTemplate generates unique URLs to avoid overwriting assets. For advanced mapping options, see External reference factory.

3 voters determine when the mapping applies. The NodeWorkspaceVoter ensures assets are in the DAM workspace.
4 storeS3 configures the S3 connection.
5 Ensure enabled is true.

S3 external content store

The Hybrid Assets module includes an S3 external content store, which also works with S3 compatible storage: info.magnolia.dam.hybrid.store.S3AssetStore.

The following are configurable properties of an S3 external content store:

Property Description

class

required

Must be info.magnolia.dam.hybrid.store.S3AssetStore.

name

required

The name of the external content store.

enabled

required

Set to true.

description

optional

A brief description of the external content store.

referencePattern

required

A Java regular expression, the external content stores whose referencePattern match the storage URL of a hybrid asset may be used to content.

buffering

optional

The buffering policy when reading or writing content to S3. Valid values:

  • inMemory - content is buffered in memory (the default)

  • inTempFile - content is buffered in a temporary file

bufferSize

optional

The maximum buffer size in bytes. The default is 1048576 (1 megabyte).

refreshClient

optional

If true, create a new connection to S3 or compatible storage each time hybrid asset is read or written.

If false (the default), connections will be cached.

Setting refreshClient = true will slow down reading and writing of hybrid asset content.

clientTTLMillis

optional

The maximum time in milliseconds a cached S3 will be kept. Connections older than clientTTLMillis will be closed and a new connection will be created as needed.

The default value is 86400000 (24 hours).

Step 3: Register the light module

Ensure your light module is registered by including a module.yaml file in the root of your light module. This file ensures Magnolia applies your decorations in the correct order.

version: 1.0
dependencies:
  hybrid-assets-advanced:
    version: "*"

Step 4: Test your configuration

  1. Restart your Magnolia instance.

  2. In the Hybrid Assets app, use the Link external content action to connect to S3 assets.

  3. Verify that assets from your S3 bucket appear and can be linked.

Troubleshooting

  • Credentials error: Ensure your AWS credentials are correct.

  • Action not available: Confirm the hybridAssets.subApps.yaml decoration is applied correctly.

  • Can not transfer asset: Ensure your credentials have the correct permissions on the configured bucket.

  • Asset conflicts: Ensure the referenceTemplate generates unique URLs to avoid overwriting assets. See External reference factory for guidance on unique templates.

For advanced users

For custom reference mappings, voters, or additional Azure store parameters, refer to External reference factory.

Feedback

Incubators

×

Location

This widget lets you know where you are on the docs site.

You are currently perusing through the Hybrid Assets module docs.

Main doc sections

DX Core Headless PaaS Legacy Cloud Incubator modules