File size: 629 Bytes
7c89ed7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | import json
import boto3
# AWS SQS Queue URL and access & secret keys
QUEUE = ''
ACCESS_KEY_ID = ''
SECRET_KEY = ''
REGION = 'us-west-2'
# Contents of the message to send to SQS
MESSAGE_BODY = {}
def main():
session = boto3.session.Session(
aws_access_key_id=ACCESS_KEY_ID,
aws_secret_access_key=SECRET_KEY,
region_name=REGION)
sqs = session.client('sqs')
response = sqs.send_message(
QueueUrl=QUEUE,
MessageBody=json.dumps(MESSAGE_BODY))
print('Got response with message ID: {}'.format(
response.get('MessageId')))
if __name__ == '__main__':
main()
|