Overview
The aws-s3 node provides access to Amazon S3 (Simple Storage Service).
Highly scalable and durable, S3 is perfect for storing sensor data, images, backups, and any file-based
data with 99.999999999% durability.
11 9's
Durability
∞
Scalability
IAM
Security
Global
Regions
Properties
| Property | Type | Default | Description |
|---|---|---|---|
| accessKeyId | string | env | AWS Access Key ID |
| secretAccessKey | string | env | AWS Secret Access Key |
| region | string | "us-east-1" | AWS region |
| bucket | string | - | S3 bucket name |
| operation | string | "put" | put, get, delete, list |
Operations
put (upload)
{
"payload": buffer_or_string,
"key": "data/sensor.json",
"contentType": "application/json"
} get (download)
{
"key": "data/sensor.json"
}
// Returns buffer in payload list
{
"prefix": "data/",
"maxKeys": 100
} delete
{
"key": "data/old-file.json"
} Example: Automatic Image Archival
Archive camera snapshots to S3 with timestamps.
// Function node: Prepare S3 upload
var timestamp = Date.now();
var date = new Date().toISOString().split('T')[0];
msg.key = "cameras/pi-001/" + date + "/" + timestamp + ".jpg";
msg.contentType = "image/jpeg";
msg.metadata = {
"x-amz-meta-device": "pi-001",
"x-amz-meta-timestamp": timestamp.toString()
};
return msg;