AWS Kinesis Streams is a core component that enables real-time data processing. Here's an example of how to put records into a Kinesis stream using the AWS SDK for Python (Boto3):
import boto3
import json
# Initialize Kinesis client
kinesis = boto3.client('kinesis')
# Example data
data = {
'sensor_id': 'sensor001',
'temperature': 25.5,
'humidity': 60.2
}
# Put record into the stream
response = kinesis.put_record(
StreamName='your-stream-name',
Data=json.dumps(data),
PartitionKey='partitionkey001'
)
print(response)