Create Shareable link to private S3 Files using MuleSoft

AWS is one of the most popular cloud platforms. Check a detailed post on AWS S3 here:

Integrating AWS S3 with MuleSoft
Learn how to integrate AWS S3 with MuleSoft

The Problem

Now let us talk about the use case we are trying to solve.

We want to share some of the private files in AWS S3 with external users for a limited period.

The Solution

AWS S3 allows us to solve this problem using Presigned URLs.

All objects by default are private. Only the object owner has permission to access these objects. However, the object owner can optionally share objects with others by creating a presigned URL, using their security credentials, to grant time-limited permission to download the objects.

Now let us create the integration using MuleSoft

Connector Configuration
  • First import the AWS S3 connector from Exchange
  • Create a Connector configuration as below

Create a private flow or a sub flow to generate presigned url

  1. We set the bucket name
  2. We set the key of the object/file we want to share
  3. We set the time till which the URL is suppose to be active
  4. We use the S3 Create object presigned URI operation to generate shareable URL
  5. We Transform the message to show output

The payload here will have the presigned URL.

Hope you liked it. Cheers ✔

Tirthankar Kundu

Tirthankar Kundu