AWS S3 Adapter
Need help? Contact us:
The AWS S3 adapter is a simple component which can be used to interact with AWS S3 buckets and their objects. The adapter provides functionality to upload, read and list objects in the bucket.
This component assumes an AWS IAM user has been set up with the correct permissions to interact with the S3 bucket(s).
How to use it:
STEP 1: Import the AWS S3 Adapter component in Iguana
See Create a Component if this is your first time!
STEP 2: Configure the AccessKey, PrivateKey, Region and BucketName custom fields and click Edit to open the Translator
Enter your AWS IAM user's AccessKey and SecretKey, as well as the Bucket's Region and BucketName. AWS documentation for creating AccessKey - SecretKey pairs
Using the information provided, the component will create an S3 adapter object that can be used to interact with your bucket.
STEP 3: View and modify the examples for uploading, reading and listing objects in an S3 bucket.
Use the provided sample data to upload sample json data to your S3 bucket. You can add samples via the Samples folder. Set live=true to enable the upload interaction from the Translator.
-- Set the absolute file path in S3 bucket for the file we'll upload
local filepath = '/JSON/sample-file.json'
-- Upload sample data to bucket as sample-file.json
local Status = S:upload{
data=jsonData,
canonicalendpoint=CanonicalEndpoint,
content_type='application/json',
live=false
}
Read the data that was uploaded to the bucket:
-- Read uploaded sample-file.json from S3 bucket
local Status, file = S:readFile{canonical_endpoint=filepath,live=true}
List the objects in the bucket:
-- List files at a specified S3 bucket path
local Status, list = S:list{canonical_endpoint='JSON/',live=true}
Resulting list response is XML data: