cartevent Kafka topic and observe how a Kafka Connect S3 sink moves those events into an S3 bucket. This walkthrough covers the producer commands, example events, and what to expect in S3 once the sink flushes data.
Prerequisites
- A running Kafka broker accessible from the EC2 instance (example uses
98.81.233.254:9092). - Kafka Connect configured with an S3 sink connector that writes to your target bucket.
- Access to the EC2 instance that hosts Kafka Connect and Kafka client tools.
Step 1 — Start a console producer
Open a terminal on the EC2 instance where Kafka is installed, become root, and change directory to the Kafka installation (the folder that contains thebin directory). Then start the Kafka console producer and point it at the cartevent topic:
Step 2 — Produce sample JSON events
Paste or type the following JSON events into the console producer (each line is a separate Kafka record):flush.size (or wait for a time-based rotation) so the sink will flush records to S3.
What you should see in S3
After the connector flushes, the records are written as files into the configured S3 bucket under the topic’s folder (for examplecartevent/partition=0/). Example object names generated by the S3 sink look like:
cartevent+0+0000000000.jsoncartevent+0+0000000002.json

How this flow works
- Producers (the console producer in this demo) send events to the Kafka topic (
cartevent). - The Kafka Connect S3 sink connector subscribes to that topic and buffers records in memory.
- When connector thresholds are reached (for example,
flush.size,rotate.interval.ms, or file-size-based rotation), the connector writes a file to S3 containing the buffered records. - The original topic data remains intact — the sink reads and copies data; it does not delete messages from Kafka. Other consumers can still read the same topic.
Kafka Connect removes the need to write and maintain custom consumers for many common integrations. S3 is one of many available sinks (others include GCS, Redis, Elasticsearch, and various databases). The connector acts as a downstream service that pulls data from Kafka and writes it to the external system.
Practical notes and tuning
- If new S3 objects do not appear immediately, refresh the S3 console. There can be slight delays due to connector buffering or eventual consistency in the console.
- Control when files are flushed using connector configuration parameters such as
flush.size,rotate.interval.ms, andcleanup.policy. - You can reverse the flow using source connectors that read from S3 (or other systems) and push data into Kafka.
Use these settings to balance latency, file size, and downstream processing needs.
Troubleshooting tips
- Verify the connector logs for errors if files are not appearing in S3.
- Confirm S3 permissions (IAM role / credentials) used by Kafka Connect allow PutObject and ListBucket on the target bucket.
- Ensure topic partitions and connector task counts are aligned to your throughput and parallelism requirements.