import json
import boto3
def lambda_handler(event, context):
sqs = boto3.resource('sqs')
queue =sqs.get_queue_by_name(QueueName='sqs-test-backup')
resp = queue.send_message(MessageBody='message from lambda',
MessageAttributes={
'foo': {
'StringValue': 'bar',
'DataType': 'String'
}
})
print('MessageId', resp.get('MessageId'))
print('MD5OfMessageBody', resp.get('MD5OfMessageBody'))
return 'ok'