Amazon S3 Executor
The Amazon S3 executor performs a task in Amazon S3 each time it receives an event.
- Create a new Amazon S3 object for the specified content
- Copy an object under 5 GB to another location in the same bucket and optionally delete the original object
- Adds tags to an existing object
Each Amazon S3 executor can perform one type of task. To perform additional tasks, use additional executors.
Use the Amazon S3 executor as part of an event stream. You can use the executor in any logical way, such as writing information from an event record to a new S3 object, or copying or tagging objects after they are written by the Amazon S3 destination.
When you configure the Amazon S3 executor, you specify the connection information, such as access keys, region, and bucket. You configure the expression that represents the object name and location. When creating new objects, you specify the content to place in the objects. When copying objects, you specify the location of the object and the location for the copy. You can also configure the executor to delete the original object after it is copied. When adding tags to an existing object, you specify the tags that you want to use.
You can optionally use an HTTP proxy to connect to Amazon S3.
AWS Credentials
When Data Collector uses the Amazon S3 executor, it must pass credentials to Amazon Web Services.
Use one of the following methods to pass AWS credentials:
- IAM role
- When Data Collector runs on an Amazon EC2 instance, you can use the AWS Management Console to configure an IAM role for the EC2 instance. Data Collector uses the IAM instance profile credentials to automatically connect to AWS.
- AWS access key pairs
- When Data Collector does not run on an Amazon EC2 instance or when the EC2 instance doesn’t have an IAM role, you must specify the Access Key ID and Secret Access Key properties in the destination.
Create New Objects
You can use the Amazon S3 executor to create new Amazon S3 objects and write the specified content to the object when the executor receives an event record.
When you create an object, you specify where to create the object and the content to write to the object. You can use an expression to represent both the location for the object and the content to use.
For example, say you want the executor to create a new Amazon S3 object for each object that the Amazon S3 destination writes, and to use the new object to store the record count information for each written object. Since the object-written event record includes the record count, you can enable the destination to generate records and route the event to the Amazon S3 executor.
${record:value('/bucket')}/${record:value('/objectKey')}.recordcount${record:value('/recordCount')}Copy Objects
You can use the Amazon S3 executor to copy an object to another location within the same bucket when the executor receives an event record. You can optionally delete the original object after the copy. The object must be under 5 GB in size.
When you copy an object, you specify the location of the object to be copied, and the location for the copy. The target location must be within the same bucket as the original object. You can use an expression to represent both locations. You can also specify whether to delete the original object.
${record:value('/bucket')}/${record:value('/objectKey')}${record:value('/bucket')}/completed/${record:value('/objectKey')}You can then select Delete Original Object to remove the original object.
To do something more complicated, like move only the subset of objects with a _west suffix to a different location, you can add a Stream Selector processor in the event stream to route only events where the /objectKey field includes a _west suffix to the Amazon S3 executor.
Tag Existing Objects
You can use the Amazon S3 executor to add tags to existing Amazon S3 objects. Tags are key-value pairs that you can use to categorize objects, such as product: <product>.
You can configure multiple tags. When you configure a tag, you can define a tag with just the key or specify a key and value. You can also use expressions to define tag values.
key: processed records
value: ${record:value('/recordCount')}For more information about tags, including Amazon S3 restrictions, see the Amazon S3 documentation.
Configuring an Amazon S3 Executor
Configure an Amazon S3 executor to create new Amazon S3 objects or to add tags to existing objects.