AWS CLI and SQS — a Tiny Demonstration

Step1: Create an SQS Queue

{
"MessageRetentionPeriod": "180"
}
aws sqs create-queue --queue-name sreeQ --attributes file://q-attributes.json
{
"QueueUrl": "https://ap-south-1.queue.amazonaws.com/nnn/sreeQ"
}
aws sqs get-queue-attributes --queue-url https://ap-south-1.queue.amazonaws.com/nnn/sreeQ --attribute-names All
{
"Attributes": {
"QueueArn": "arn:aws:sqs:ap-south-1:nnn:sreeQ",
"ApproximateNumberOfMessages": "0",
"ApproximateNumberOfMessagesNotVisible": "0",
"ApproximateNumberOfMessagesDelayed": "0",
"CreatedTimestamp": "1540707132",
"LastModifiedTimestamp": "1540707132",
"VisibilityTimeout": "30",
"MaximumMessageSize": "262144",
"MessageRetentionPeriod": "180",
"DelaySeconds": "0",
"ReceiveMessageWaitTimeSeconds": "0"
}
}

Step-2: Sending Messages to our AWS SQS Queue

aws sqs send-message --queue-url https://ap-south-1.queue.amazonaws.com/nnn/sreeQ --message-body "IOT-1 Temp: 51C"
{
"MD5OfMessageBody": "8947cd39e126a7a7985cc884c05e8bfa",
"MessageId": "a5fb9702-ecfb-4ad3-8791-31b08dba5ae0"
}
aws sqs --region ap-south-1 receive-message --queue-url https://ap-south-1.queue.amazonaws.com/nnn/sreeQ
{
"Messages": [
{
"MessageId": "e7c287de-c4a6-4158-a0a8-2b986e346518",
"ReceiptHandle": "AQEB9P5rdqGshIuHIlxBrrfc8GFyDweOh6kuHoWXmskg7AZLjkDxorkZTfBe10AdHxADAVSKcE5ovnM/g3cddowWtv4EuZNqZ3b0efT/im76eR5mfihPPJEg0csTSTjkr0Wi9qOF85dw7xoO8MakbG/LFcFp0LOoHRCp6z7BtR8+24C3s2kVVLyBU8RhQri5kmzxTk1UNqDPULXbDGAqb8BC3WhE9C+LQjTQDtHUWdEjJWPPa4TMhRclQzPhacchGrEGqWm8fVQDsuCY7Qm5hE40IclNtZxNTSbueAuJMOAiQPCnepExpLkoMXEFfsfshg5+hJe86pGMGzI8R3ntpuFNvjqvj7wIy5MZMDGrNFho23oA1A8t/Ct9MOZQLeniC3Lu",
"MD5OfBody": "e317cf0ea6dee8619f0c734d8dc4ee8a",
"Body": "IOT-1 Temp: 51C"
}
]
}
aws sqs --region ap-south-1 delete-message --queue-url https://ap-south-1.queue.amazonaws.com/nnn/sreeQ --receipt-handle "AQEB9P5rdqGshIuHIlxBrrfc8GFyDweOh6kuHoWXmskg7AZLjkDxorkZTfBe10AdHxADAVSKcE5ovnM/g3cddowWtv4EuZNqZ3b0efT/im76eR5mfihPPJEg0csTSTjkr0Wi9qOF85dw7xoO8MakbG/LFcFp0LOoHRCp6z7BtR8+24C3s2kVVLyBU8RhQri5kmzxTk1UNqDPULXbDGAqb8BC3WhE9C+LQjTQDtHUWdEjJWPPa4TMhRclQzPhacchGrEGqWm8fVQDsuCY7Qm5hE40IclNtZxNTSbueAuJMOAiQPCnepExpLkoMXEFfsfshg5+hJe86pGMGzI8R3ntpuFNvjqvj7wIy5MZMDGrNFho23oA1A8t/Ct9MOZQLeniC3Lu"
aws sqs --region ap-south-1 delete-queue --queue-url https://ap-south-1.queue.amazonaws.com/nnn/sreeQ

Sreeprakash Neelakantan

Written by

AWS Certified DevOps Engineer & Solutions Architect Professional — Docker | Kubernetes | DevOps — Trainer | Running | Swimming | Cycling

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade