Package Exports
- sanity-plugin-s3-dam
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (sanity-plugin-s3-dam) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
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.

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)
- Refer to S3's guide on CORS if this is new to you (it was for me too!)
- You can use the template at s3Cors.example.json
- 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.
I plan on recording a video tutorial going through the process in detail. Until then, reach out if you have questions 😉
Using
Use the s3-dam.media type in your fields. Examples:
{
name: "video",
title: "Video (S3)",
type: "s3-dam.media",
options: {
accept: "video/*",
storeOriginalFilename: true,
},
},
{
name: "anyFile",
title: "File (S3)",
type: "s3-dam.media",
options: {
// Accept ANY file
accept: "*",
storeOriginalFilename: true,
},
},Contributing, roadmap & acknowledgments
Refer to sanity-plugin-external-dam for those :)