The create-metadata script can probe one or more image files and set the appropriate width, height, pages, and tile size metadata. It can be invoked three different ways
- As a standalone script
- As a Lambda function
- As an S3 Batch Operation
Make sure the AWS CLI is properly configured with credentials that have read/write access to the S3 bucket containing the images that will be served by serverless-iiif
Clone this repository.
Install runtime dependencies:
npm ciRun the script:
export sourceBucket="my-image-bucket" # corresponds to the SourceBucket deploy parameter
export resolverTemplate="%s.tif" # corresponds to the ResolverTemplate deploy parameter
npm run create-metadata image_id_1 image_id_2 image_id_3Or to process every file in the bucket, regardless of type:
export sourceBucket="my-image-bucket"
export resolverTemplate="%s"
aws s3 ls --recursive s3://my-image-bucket/ \
| awk '{ print $4 }' \
| xargs -n 50 npm run create-metadataVerify the output:
aws s3api head-object --bucket my-image-bucket --key image_id_1.tif- A
serverless-iiifapplication stack deployed withCreateMetadataFunctionset totrue
Get the value of the MetadataFunctionARN output from the deployed stack.
Determine the ID of the image (as it will look in the ID part of the IIIF URL).
Invoke the Lambda Function with the payload { imageId: "ID_OF_IMAGE" }
- A
serverless-iiifapplication stack deployed withCreateMetadataFunctionset totrue
Get the value of the MetadataFunctionARN output from the deployed stack.
Create an S3 Batch Operation specifying the MetadataFunctionARN as the operation. The manifest must only include objects from the image source bucket, as that is the only bucket the Lambda Function has access to.