Skip to content

Instantly share code, notes, and snippets.

@diogodilcl
Last active April 22, 2021 21:28
Show Gist options
  • Save diogodilcl/ebbf4df5c3784bfd7df148f960fd0230 to your computer and use it in GitHub Desktop.
Save diogodilcl/ebbf4df5c3784bfd7df148f960fd0230 to your computer and use it in GitHub Desktop.
import json
import random
import string
import time
import uuid
import boto3
client = boto3.client('kinesis')
for _ in range(1000):
data = {
'id': str(uuid.uuid4()),
'random_number': random.randint(60, 120),
'random_string': ''.join(random.choice(string.ascii_lowercase) for i in range(10))
}
print(data)
response = client.put_record(
StreamName='data_streaming',
Data=json.dumps(data),
PartitionKey="partitionkey")
time.sleep(0.3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment