AWS S3 media browser

By Henrique Doro

Allows uploading, referencing and deleting video and audio files to S3 directly from your Sanity studio.

AWS S3 Digital Asset Management (DAM) plugin for Sanity.io

Allows uploading, referencing and deleting video and audio files to S3 directly from your Sanity studio. Is a flavor of sanity-plugin-external-dam.

Screenshots:

Screenshot of the file uploader Screenshot of the file preview Screenshot of the file browser Screenshot of the file details Screenshot of the credentials set-up

Installing

Start by installing the plugin:

sanity install s3-dam

The rest of the work must be done inside AWS' console:

  • Create a public S3 bucket (or use an existing one)
  • Configure CORS for your bucket to accept the origins your studio will be hosted in (including localhost)
  • Create Lambda functions for creating the pre-signed URLs we'll use to post objects to S3 and deleting objects
    • Use the templates at getSignedUrl.example.js and deleteObject.example.js
    • Set the necessary permissions for execution role of each function:
      • getSignedUrl: "Write->PutObject" and "Permissions Management->PutObjectAcl"
      • deleteObject: "Write->DeleteObject"
    • Make these functions available through HTTP requests by adding API Gateway triggers
      • Ensure these gateways have CORS enabled for the origins you'll use
      • I strongly recommend using the same gateway for both functions for simplicity of configuration

With these in hand, fill-in the plugin's configuration form where you'll fill in the bucket key (ex: my-sanity-bucket), the bucket region (ex: ap-south-1), the URL for both Lambda functions and an optional secret for validating input in functions.

๐Ÿšจ If not using a secret, make sure your Lambda functions do not check for it.

I plan on recording a video tutorial going through the process in detail. Until then, reach out if you have questions ๐Ÿ˜‰

Contributing, roadmap & acknowledgments

Refer to sanity-plugin-external-dam for those :)

Install command

sanity install s3-dam

Contributor

Other plugins by author