Get Object
Retrieves metadata information about an S3 object without downloading the actual file content.
Common Properties
- Name - The custom name of the node.
- Color - The custom color of the node.
- Delay Before (sec) - Waits in seconds before executing the node.
- Delay After (sec) - Waits in seconds after executing node.
- Continue On Error - Automation will continue regardless of any error. The default value is false.
If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.
Inputs
- Client Id - The client connection ID from the Connect node. Optional if using credentials directly.
- Bucket Name - The name of the S3 bucket containing the object.
- Object Name - The key/name of the object to get information about, including any prefixes (folder path).
Options
- End Point - S3 endpoint URL. Required only if using credentials directly instead of Client ID.
- Access Key Id - AWS Access Key ID credential. Optional - use this instead of Client ID for direct authentication.
- Secret Key Access - AWS Secret Access Key credential. Optional - use this instead of Client ID for direct authentication.
Output
- result - An object containing metadata about the S3 object, including size, content type, last modified date, ETag, and user metadata.
How It Works
The Get Object node retrieves detailed information about an S3 object without downloading the file content. When executed, the node:
- Retrieves the S3 client using either the Client ID or creates a new client from credentials
- Validates that the bucket name and object name are provided and not empty
- Sends a HEAD request to S3 to retrieve object metadata
- Returns the metadata information as the result
- Completes successfully without downloading the file content
Requirements
- Either a valid Client ID from a Connect node, or Access Key ID and Secret Access Key credentials
- A valid S3 bucket with the object to query
- Appropriate S3 permissions to read object metadata (s3:GetObject)
Error Handling
The node will return specific errors in the following cases:
- Empty or invalid bucket name
- Empty or invalid object name
- Object does not exist in the bucket
- Invalid Client ID or credentials
- Bucket does not exist
- Insufficient permissions to access object metadata
- Network or connection errors
Output Structure
The result object contains the following information:
{
"Key": "documents/report.pdf",
"Size": 1048576,
"ContentType": "application/pdf",
"LastModified": "2024-03-15T10:30:00Z",
"ETag": "\"d41d8cd98f00b204e9800998ecf8427e\"",
"StorageClass": "STANDARD",
"Metadata": {
"uploaded-by": "automation-bot",
"document-type": "report"
},
"VersionID": ""
}
Metadata Fields
- Key - The object's key (name) in S3
- Size - Size of the object in bytes
- ContentType - MIME type of the object
- LastModified - Timestamp when the object was last modified
- ETag - Entity tag (checksum) of the object
- StorageClass - The storage class (STANDARD, GLACIER, etc.)
- Metadata - Custom user metadata attached to the object
- VersionID - Version ID if bucket versioning is enabled
Usage Notes
- This operation is much faster than downloading the file
- No data transfer costs are incurred (only metadata retrieval)
- Useful for checking if an object exists before downloading
- ETag can be used to verify file integrity
- Size information helps with disk space planning
- LastModified helps with synchronization logic
- Custom metadata is returned in the Metadata field
Best Practices
- Use Get Object to verify object existence before download
- Check object size before downloading to ensure sufficient disk space
- Use ETag to detect if an object has changed
- Leverage LastModified for incremental sync operations
- Validate content type matches expectations before processing
- Cache metadata when processing multiple objects
- Use this node instead of downloading when you only need metadata
Example
To get information about a PDF document:
Inputs:
- Client Id: (from Connect node)
- Bucket Name:
company-documents - Object Name:
reports/annual-report-2024.pdf
Output:
{
"Key": "reports/annual-report-2024.pdf",
"Size": 2457600,
"ContentType": "application/pdf",
"LastModified": "2024-03-15T14:30:00Z",
"ETag": "\"5f363e0e58a95f06cbe9bbc662c5dfb6\"",
"StorageClass": "STANDARD",
"Metadata": {
"year": "2024",
"department": "finance",
"status": "approved"
}
}
Common Use Cases
File Existence Check Verify an object exists before attempting to download or process it:
- Get Object - Check if file exists
- Conditional - If exists, proceed with download
- Download Object - Download the file
Size Validation Check file size before downloading to ensure sufficient disk space:
const metadata = result; // Output from Get Object
const fileSizeInMB = metadata.Size / 1024 / 1024;
if (fileSizeInMB > 100) {
// Handle large file differently
}
Change Detection Compare ETag or LastModified to detect if a file has changed:
// Store previous ETag
const previousETag = "\"abc123...\"";
const currentETag = result.ETag;
if (currentETag !== previousETag) {
// File has changed, download new version
}
Incremental Sync Download only files that have been modified since last sync:
const lastSyncTime = new Date('2024-03-01T00:00:00Z');
const objectModified = new Date(result.LastModified);
if (objectModified > lastSyncTime) {
// Download updated file
}
Storage Cost Analysis Calculate storage costs based on object size and storage class:
const sizeInGB = result.Size / (1024 * 1024 * 1024);
const storageClass = result.StorageClass;
// Calculate costs based on AWS pricing
Direct Credentials Example
Inputs:
- Bucket Name:
my-data - Object Name:
exports/data-2024-03.csv
Options:
- End Point:
s3.us-west-2.amazonaws.com - Access Key Id: (your AWS Access Key ID credential)
- Secret Key Access: (your AWS Secret Access Key credential)
Working with Metadata
Access custom metadata from the result:
const metadata = result.Metadata;
const uploadedBy = metadata['uploaded-by'];
const documentType = metadata['document-type'];
Note: S3 stores user metadata with the x-amz-meta- prefix, but this is stripped in the response.
Conditional Download Example
Download only if file is newer than local version:
- Get Object - Get S3 object metadata
- Get Local File Info - Get local file modification time
- Compare Dates - Compare LastModified times
- Conditional Download - Download only if S3 version is newer
Common Errors
Error: "NoSuchKey: The specified key does not exist"
- Solution: Verify the object name is correct, including the full path with prefixes
Error: "NoSuchBucket: The specified bucket does not exist"
- Solution: Verify the bucket name is correct and the bucket exists
Error: "Access Denied"
- Solution: Ensure your credentials have the s3:GetObject permission
Error: "Invalid Client ID"
- Solution: Verify the Client ID from the Connect node is being passed correctly
Performance Benefits
- Much faster than downloading the file (no data transfer)
- Minimal bandwidth usage
- No disk space required
- Can query thousands of objects quickly
- Useful for building file catalogs or indexes
- Ideal for validation and verification workflows