Amazon S3

The following document assumes that you understand the basics of connecting to databases on Appsmith. If not, please go over them before reading further.

The Amazon S3 plugin can connect to an Amazon S3 instance and execute a set of actions supported by Appsmith.

Connection Settings

The Amazon S3 Datasource requires the following information to establish a connection

Click to expand
  1. Amazon Access Key ID

  2. Amazon Secret Key

The Access Key & Secret can be fetched using the following guide: Generate AWS access key & secret

List Files

This action lists all the files in a bucket. The bucket name is the bucket from which all the files are fetched. This action returns an array of file paths relative to the bucket. ex. /dir/fileName.txt.

You can also choose to generate a signed URL for each listed file by selecting Yes in the Generate Signed URL dropdown. An expiry duration can be set for the generated signed URLs by editing the Expiry Duration of Signed URL field. In this case, the output returns two other fields:

  • signedUrl: It contains the signed url for the file.

  • urlExpiryDate: It contains the timestmap at which the signed url will expire.

Click to expand

Create File

This action creates a new file at the location specified by the file path (including file name). The action returns the following two fields:

  • signedUrl: It contains the signed url for the file.

  • urlExpiryDate: It contains the timestmap at which the signed url will expire.

An expiry duration can be set for the generated signed URLs by editing the Expiry Duration of Signed URL field.

If a file already exists on the file path, it will be replaced with the new file.

Read File

This action fetches a file in the Bucket Name specified with a file path relative to the bucket. By default, the raw content of the file is returned in the fileData field of response. File content can also be Base64 encoded by selecting Yes in the Base64 Encode File - Yes/No dropdown field.

When reading multimedia file or formatted text, please encode the file data using the Base64 Encode dropdown field. Once the data has been received, it can be decoded using the atob() method in javascript.

Click to expand

Delete File

This action deletes a file at the file path relative to the Bucket Name specified. Files deleted cannot be restored so ensure your files have been backed up.

Enable the confirmation setting in this query to avoid accidental file deletes

Click to expand

Using Queries in applications

Once you have successfully run a Query, you can use it in your application to