In this simple example, I configure AWS Boto3 to send a message to known queue.
import boto3 sqs = boto3.resource('sqs') queue = sqs.get_queue_by_name(QueueName='Your_Queue_Name') response = queue.send_message(MessageBody='BodyText') print(response.get('MD5OfMessageBody'))
Note - you must configure your Access Credentials, the way they can be done is given in the URL Belowhttps://boto3.amazonaws.com/v1/documentation/api/latest/guide/configuration.html#guide-configurationI generally prefer to set it as my shell variable, but it is totally up to you.The user/object with which you are accessing should have SQS Policy Attached so that it can write to the Queue.
No comments:
Write comments