How to Create & Configure Simple Queue Service(SQS) on Amazon Web Service(AWS).

Amazon SQS provides queues for high-throughput, system-to-system messaging.We can use queues to decouple heavy weight processes and to buffer and batch work.

Amazon SQS is a web service that gives you access to a message queue that can be used to store messages while waiting for a computer to process them.

 

  • Login to aws portal.
  • Click on Services.

 

Fig 1

 

  • Under Application Integration select Simple Queue Service.

 

Fig 2

 

  • Click on Create Queue.

 

Fig. 3

 

  • Select Queue Type: FIFO(first-in,first-out) or Standard. Standard provide at-least-once message delivery, which means that each message is delivered at least once.
  • FIFO provide exactly-once message delivery, which means that each message is delivered once and remains available until a consumer processes it and deletes it.
  • Provide Queue name.

 

Fig. 4

 

  • Set maximum message size, visibility,& message retention.

 

Fig. 5

 

  • Set access policy who can send or receive message.

 

Fig. 6

 

  • Amazon SQS provides in-transit encryption method.

 

Fig. 7

 

  • We can send un-deliverable message to a dead-letter queue. By default,it is disabled.
  • Provide tag key name & value.
  • Click on Create queue.

 

Fig. 8

 

  • After sometime Queue created successfully.
  • Click on Subscribe to Amazon SNS topic

 

Fig 9

 

 

Fig 10

 

  • Once Subscribe to Amazon SNS topic is done, Click on Send & Receive Message.

 

Fig 11

 

  • Provide Message Body,
  • Set message Attributes.
  • Click on Send Message.

 

Fig 12

 

  • Message has been sent & is ready to be received.

 

Fig 13

 

Create Simple Queue Service using Shell

To create a queue

aws sqs create-queue –queue-name Queue-Name –attributes /path/of/create-queue.json

The create-queue.json file is given below:

{
“RedrivePolicy”: “{\”deadLetterTargetArn\”:\”arn:aws:sqs:us-east-1:80398EXAMPLE:MyDeadLetterQueue\”,\”maxReceiveCount\”:\”1000\”}”,
“MessageRetentionPeriod”: “259200”
}

 

To send a message

aws sqs send-message –queue-url https://sqs.us-east-1.amazonaws.com/80398EXAMPLE/MyQueue –message-body “example” –delay-seconds 10 –message-attributes /path/of/send-message.json

The send-message.json file is given below:

“City”: {
“DataType”: “String”,
“StringValue”: “Any City”
},
“Greeting”: {
“DataType”: “Binary”,
“BinaryValue”: “Hello, World!”
},
“Population”: {
“DataType”: “Number”,
“StringValue”: “1250800”
}
}

To receive a message

aws sqs receive-message –queue-url https://sqs.us-east-1.amazonaws.com/80398EXAMPLE/MyQueue –attribute-names All –message-attribute-names All –max-number-of-messages 10

 

Leave a Reply

Your email address will not be published.