in services/s3-new-image-event.py [0:0]
def insertRecordIntoSqs(payloadBody):
sqs = boto3.client('sqs')
queue_url = os.environ['SQS_QUEUE_URL']
# Send message to SQS queue
response = sqs.send_message(
QueueUrl=queue_url,
DelaySeconds=1,
MessageAttributes={
'bucketName': {
'DataType': 'String',
'StringValue': payloadBody['bucketName']
},
'objectKey': {
'DataType': 'String',
'StringValue': payloadBody['objectKey']
},
'objectUrl': {
'DataType': 'String',
'StringValue': payloadBody['objectUrl']
}
},
MessageBody=(
json.dumps(payloadBody)
)
)
return response