You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: modules/components/pages/inputs/aws_s3.adoc
+46-8Lines changed: 46 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@
12
12
component_type_dropdown::[]
13
13
14
14
15
-
Downloads objects within an Amazon S3 bucket, optionally filtered by a prefix, either by walking the items in the bucket or by streaming upload notifications in realtime.
15
+
Downloads objects within an Amazon S3 bucket, optionally filtered by a prefix, either by walking the items in the bucket or by streaming upload notifications in real time.
A common pattern for consuming S3 objects is to emit upload notification events from the bucket either directly to an SQS queue, or to an SNS topic that is consumed by an SQS queue, and then have your consumer listen for events which prompt it to download the newly uploaded objects. More information about this pattern and how to set it up can be found at in the https://docs.aws.amazon.com/AmazonS3/latest/dev/ways-to-add-notification-config-to-bucket.html[Amazon S3 docs].
42
+
A common pattern for consuming S3 objects is to emit upload notification events from the bucket either directly to an SQS queue, or to an SNS topic that is consumed by an SQS queue, and then have your consumer listen for events that prompt it to download the newly uploaded objects. More information about this pattern and how to set it up can be found in the https://docs.aws.amazon.com/AmazonS3/latest/dev/ways-to-add-notification-config-to-bucket.html[Amazon S3 docs].
43
43
44
-
Redpanda Connect is able to follow this pattern when you configure an `sqs.url`, where it consumes events from SQS and only downloads object keys received within those events. In order for this to work Redpanda Connect needs to know where within the event the key and bucket names can be found, specified as xref:configuration:field_paths.adoc[dot paths] with the fields `sqs.key_path` and `sqs.bucket_path`. The default values for these fields should already be correct when following the guide above.
44
+
Redpanda Connect is able to follow this pattern when you configure an `sqs.url`, where it consumes events from SQS and downloads only the object keys contained in those events. For this to work, Redpanda Connect needs to know where within the event the key and bucket names can be found, specified as xref:configuration:field_paths.adoc[dot paths] with the fields `sqs.key_path` and `sqs.bucket_path`. The default values for these fields should already be correct when following the guide above.
45
45
46
-
If your notification events are being routed to SQS via an SNS topic then the events will be enveloped by SNS, in which case you also need to specify the field `sqs.envelope_path`, which in the case of SNS to SQS will usually be `Message`.
46
+
If your notification events are being routed to SQS via an SNS topic, the events are enveloped by SNS, in which case you also need to specify the field `sqs.envelope_path`, which in the case of SNS to SQS will usually be `Message`.
47
47
48
-
When using SQS please make sure you have sensible values for `sqs.max_messages` and also the visibility timeout of the queue itself. When Redpanda Connect consumes an S3 object the SQS message that triggered it is not deleted until the S3 object has been sent onwards. This ensures at-least-once crash resiliency, but also means that if the S3 object takes longer to process than the visibility timeout of your queue then the same objects might be processed multiple times.
48
+
When using SQS, make sure you have sensible values for `sqs.max_messages` and also the visibility timeout of the queue itself. When Redpanda Connect consumes an S3 object the SQS message that triggered it is not deleted until the S3 object has been sent onwards. This ensures at-least-once crash resiliency, but also means that if the S3 object takes longer to process than the visibility timeout of your queue, then the same objects might be processed multiple times.
49
49
50
50
== Download large files
51
51
52
-
When downloading large files it's often necessary to process it in streamed parts in order to avoid loading the entire file in memory at a given time. In order to do this a <<scanner, `scanner`>> can be specified that determines how to break the input into smaller individual messages.
52
+
When downloading large files, process them in streamed parts to avoid loading the entire file into memory at once. To do this, specify a <<scanner, `scanner`>> that determines how to break the input into smaller individual messages.
53
+
54
+
== Bucket and prefix
55
+
56
+
The `bucket` field accepts a bucket name only, not an ARN. For example, use `my-bucket`, not `arn:aws:s3:::my-bucket`.
57
+
58
+
The `prefix` field accepts a single string. To consume from multiple prefixes in the same bucket, use multiple `aws_s3` inputs in a xref:components:inputs/broker.adoc[`broker` input]:
59
+
60
+
```yaml
61
+
input:
62
+
broker:
63
+
inputs:
64
+
- aws_s3:
65
+
bucket: my-bucket
66
+
prefix: logs/app1/
67
+
- aws_s3:
68
+
bucket: my-bucket
69
+
prefix: logs/app2/
70
+
```
53
71
54
72
== Credentials
55
73
56
-
By default Redpanda Connect will use a shared credentials file when connecting to AWS services. It's also possible to set them explicitly at the component level, allowing you to transfer data across accounts. You can find out more in xref:guides:cloud/aws.adoc[].
74
+
By default, Redpanda Connect uses a shared credentials file when connecting to AWS services. You can also set credentials explicitly at the component level to transfer data across accounts. You can find out more in xref:guides:cloud/aws.adoc[AWS credentials].
75
+
76
+
== S3-compatible storage
77
+
78
+
The `endpoint` and `force_path_style_urls` fields let you connect to S3-compatible storage services such as Cloudflare R2, MinIO, or DigitalOcean Spaces.
79
+
80
+
For Cloudflare R2, set `endpoint` to your account endpoint URL and enable `force_path_style_urls`:
Find your account ID in the Cloudflare dashboard under *R2 > Overview > Account Details*. Generate API credentials under *R2 > Manage R2 API Tokens*.
57
95
58
96
== Metadata
59
97
@@ -68,7 +106,7 @@ This input adds the following metadata fields to each message:
68
106
- s3_version_id
69
107
- All user defined metadata
70
108
71
-
You can access these metadata fields using xref:configuration:interpolation.adoc#bloblang-queries[function interpolation]. Note that user defined metadata is case insensitive within AWS, and it is likely that the keys will be received in a capitalized form, if you wish to make them consistent you can map all metadata keys to lower or uppercase using a Bloblang mapping such as `meta = meta().map_each_key(key -> key.lowercase())`.
109
+
You can access these metadata fields using xref:configuration:interpolation.adoc#bloblang-queries[function interpolation]. User-defined metadata is case insensitive in AWS, so keys are often received in capitalized form. To normalize them, map all metadata keys to lowercase or uppercase using a Bloblang mapping such as `meta = meta().map_each_key(key -> key.lowercase())`.
In order to have a different path for each object you should use function interpolations described in xref:configuration:interpolation.adoc#bloblang-queries[Bloblang queries], which are calculated per message of a batch.
43
+
To use a different path for each object, use xref:configuration:interpolation.adoc#bloblang-queries[function interpolation], which is evaluated for each message in a batch.
44
44
45
45
== Metadata
46
46
47
-
Metadata fields on messages will be sent as headers, in order to mutate these values (or remove them) check out the xref:configuration:metadata.adoc[metadata docs].
47
+
Redpanda Connect sends metadata fields as headers. To mutate or remove these values, see the xref:configuration:metadata.adoc[metadata docs].
48
48
49
49
== Tags
50
50
51
-
The tags field allows you to specify key/value pairs to attach to objects as tags, where the values support xref:configuration:interpolation.adoc#bloblang-queries[interpolation functions]:
51
+
The `tags` field accepts key/value pairs to attach to objects as tags, and the values support xref:configuration:interpolation.adoc#bloblang-queries[interpolation functions]:
52
52
53
53
```yaml
54
54
output:
@@ -60,15 +60,15 @@ output:
60
60
Timestamp: ${!meta("Timestamp")}
61
61
```
62
62
63
-
=== Credentials
63
+
== Credentials
64
64
65
-
By default Redpanda Connect will use a shared credentials file when connecting to AWS services. It's also possible to set them explicitly at the component level, allowing you to transfer data across accounts. You can find out more in xref:guides:cloud/aws.adoc[].
65
+
By default, Redpanda Connect uses a shared credentials file when connecting to AWS services. You can also set credentials explicitly at the component levelto transfer data across accounts. You can find out more in xref:guides:cloud/aws.adoc[AWS credentials].
66
66
67
67
== Batching
68
68
69
69
It's common to want to upload messages to S3 as batched archives. The easiest way to do this is to batch your messages at the output level and join the batch of messages with an xref:components:processors/archive.adoc[`archive`] or xref:components:processors/compress.adoc[`compress`] processor.
70
70
71
-
For example, the following configuration uploads messages as a .tar.gz archive of documents:
71
+
For example, the following configuration uploads messages as a `.tar.gz` archive of documents:
72
72
73
73
```yaml
74
74
output:
@@ -85,7 +85,7 @@ output:
85
85
algorithm: gzip
86
86
```
87
87
88
-
Alternatively, this configuration uploads JSON documents as a single large document containing an array of objects:
88
+
This configuration uploads JSON documents as a single large document containing an array of objects:
89
89
90
90
```yaml
91
91
output:
@@ -99,6 +99,31 @@ output:
99
99
format: json_array
100
100
```
101
101
102
+
== Bucket name format
103
+
104
+
The `bucket` field accepts a bucket name only, not an ARN. For example, use `my-bucket`, not `arn:aws:s3:::my-bucket`.
105
+
106
+
== S3-compatible storage
107
+
108
+
The `endpoint` and `force_path_style_urls` fields let you connect to S3-compatible storage services such as Cloudflare R2, MinIO, or DigitalOcean Spaces.
109
+
110
+
For Cloudflare R2, set `endpoint` to your account endpoint URL and enable `force_path_style_urls`:
Find your account ID in the Cloudflare dashboard under *R2 > Overview > Account Details*. Generate API credentials under *R2 > Manage R2 API Tokens*.
126
+
102
127
== Performance
103
128
104
129
This output benefits from sending multiple messages in flight in parallel for improved performance. You can tune the max number of in flight messages (or message batches) with the field `max_in_flight`.
0 commit comments