Integrate Amazon S3(Simple Storage Service) into WaveMaker App
Learn how to implement file upload, download and delete file on S3 bucket using AWS S3 Connector.
AWS S3 Connector
Amazon S3 (Simple Storage Service) is a scalable, high-speed, low-cost web-based service designed for online backup and archiving of data and application programs. It allows to upload, store, and download any type of files up to 5 TB in size. This service allows the subscribers to access the same systems that Amazon uses to run its own web sites. The subscriber has control over the accessibility of data, i.e. privately/publicly accessible.
This connector exposes api to interact with AWS S3 from WaveMaker application.
Step 1: Importing the aws-s3-connector to project
- Download the latest aws-s3-connector zip here
- Import the downloaded aws-s3-connector zip into your app using the Import Resource option to the Connector folder.
Step 2: Configure aws-s3-connector properties in profiles
- By default externalized connector properties are added in the project profiles Know More.
- Connector externalized properties are prefixed with connector.${connectorName}
Step3: Perform File Operations in Storage Account.
Autowire the Connector Service into the added JavaService.
Import Statement:
1. Upload file to Amazon S3 bucket.
Uploads a new file object to the specified Amazon S3 bucket.
Import statements required:
Source Code:
The third param for upload API is the custom metadata. Add the key value pairs of the custom user-metadata for the associated file object. If the entry in the custom user-metadata map already contains the specified key, it will be replaced with these new contents.
2. List files from Amazon S3.
Returns a list of summary information about the objects in the specified bucket.
Import statements required:
Source Code:
3. Download file from S3.
Gets the object from Amazon S3 under the specified bucket.
Import statements required:
Source Code:
4. Delete file in S3.
Deletes the specified object in the specified bucket.
Source Code:
s3KeyName is the file key name. Example: IMG_20200202.jpg