In modern cloud architecture, applications are broken into smaller, independent components that are easier to build, maintain, and deploy. Message queues play a key role in connecting these systems, ensuring reliability, scalability, and smooth communication. They store messages until processed, making them ideal for managing spiky workloads, decoupling heavy processes, and batching tasks.

Amazon’s Simple Queue Service (SQS) is a powerful solution for managing message queues in distributed systems. With the AWS Command Line Interface (CLI), you can easily automate the control and management of AWS services, including SQS. This blog dives into using AWS CLI with SQS, covering how to send and receive messages, along with the key benefits of SQS.

What is AWS SQS?

aws cli sqs: aws sqs logo

Amazon Simple Queue Service (SQS) is a fully managed message queuing service that simplifies scaling and decoupling microservices, distributed systems, and serverless applications. It eliminates the hassle of managing middleware, so developers can focus on building great solutions. With SQS, you can send, store, and receive messages at any scale without worrying about message loss or service availability.

Getting started is quick and easy with the AWS Management Console, CLI, or SDK—just three simple commands, and you’re good to go! SQS ensures security, durability, and availability, offering features like dead-letter queues and cost allocation tags. It also provides a flexible web services API compatible with all AWS SDK-supported programming languages.

SQS supports two types of queues:

  • Standard Queues: High throughput, best-effort ordering, and at-least-once delivery.
  • FIFO Queues: Guarantee exact order and ensure messages are processed exactly once.

Unlike traditional messaging services like IBM WebSphere MQ or Microsoft Message Queuing, SQS is fully managed by Amazon, so there’s no server maintenance—just pay for what you use!

aws cli sqs: amazon sqs process

Key Benefits of AWS SQS

  • Eliminate Administrative Overhead: AWS handles all operations and infrastructure, so there’s no need to buy, install, or maintain messaging software. SQS queues scale automatically, allowing you to build and grow applications quickly.
  • Reliably Deliver Messages: SQS ensures reliable message delivery at any scale, decouples application components for better fault tolerance, and stores messages across multiple Availability Zones for availability.
  • Keep Sensitive Data Secure: SQS encrypts messages using Server-Side Encryption (SSE) and integrates with AWS KMS for managing encryption keys, with logs stored in AWS CloudTrail for compliance.
  • Scale Elastically and Cost-Effectively: SQS scales with demand, eliminating the need for capacity planning and charges based on usage, offering cost savings over self-managed systems.
  • Customization: You can customize queues with delays or store large messages in S3/DynamoDB, with SQS holding a pointer to the object or splitting the message into smaller parts.
aws cli sqs: benefits of amazon sqs
Set up Seamless Data Ingestion Pipelines from AWS Sources using Hevo

Hevo Data, a Fully-managed Automated Data Pipeline solution, can help you automate, simplify & enrich your data flow from various AWS sources such as AWS S3 and AWS Elasticsearch in a matter of minutes. Hevo’s end-to-end Data Management offers streamlined preparation of Data Pipelines for your AWS account. Additionally, Hevo completely automates the process of not only extracting data from AWS S3 and AWS Elasticsearch but also enriching the data and transforming it into an analysis-ready form without having to write a single line of code.

Explore Hevo’s salient features:

  • Live Monitoring & Support: Hevo provides live data flow monitoring and 24/5 customer support via chat, email, and calls.
  • Secure & Reliable: Hevo’s fault-tolerant architecture ensures secure, consistent data handling with zero loss and automatic schema management.
  • User-Friendly & Scalable: Hevo’s simple UI makes it easy for new users, while its horizontal scaling manages growing data volumes with minimal latency.
  • Efficient Data Transfer: Hevo supports real-time, incremental data loads, optimizing bandwidth usage for both ends.
Get Started with Hevo for Free

What is AWS CLI?

aws cli sqs : aws cli logo

The AWS Command Line Interface (CLI) is a powerful, centralized tool for managing your AWS accounts and services. It enables you to control, configure, and automate various AWS services directly from your terminal or command prompt. With the AWS CLI, you can interact with AWS resources like EC2, S3, IAM, and more, all from a single interface.

The AWS CLI simplifies tasks like managing cloud infrastructure, automating processes through scripts, and handling multiple services at once. It eliminates the need for navigating the AWS Management Console, streamlining workflows, especially for repetitive tasks. By using the CLI, you can speed up deployment, scale operations efficiently, and integrate with other tools or CI/CD pipelines. Plus, it’s easy to download, install, and configure, making it accessible for developers and system administrators alike.

Understanding AWS CLI SQS

A user is connected to a computer program or operating system via a command-line interface. Users interact with a system or application using the CLI by typing in text. Following a visual prompt from the computer, the command is typed on a specific line. AWS SQS is a message queuing service that enables users to send and receive messages.

AWS CLI allows users to send and receive messages by using specific commands. Some of the  commands are available in AWS CLI SQS are

AWS CLI SQS: add-permission

This command adds permission for a specific principal to a queue. It enables queue access to be shared. You have complete control over the queue’s access rights when you create it in AWS CLI SQS. Only you, as the queue’s owner, have the authority to grant or deny permissions.

Some things to keep in mind while using this command are:

  • The command “AddPermission” creates a policy for you. To upload your policy, use “SetQueueAttributes “.
  • A single Amazon SQS policy can have up to seven actions.
  • You must deny permission to the “AddPermission,” “RemovePermission,” and “SetQueueAttributes” actions in your IAM policy to remove the ability to change queue permissions.

Some actions accept parameters in the form of a list. The param.n notation is used to specify these lists. The integers 1 to n are the values of n.

&AttributeName.1=first
&AttributeName.2=second

Synopsis

add-permission
--queue-url <value>
--label <value>
--aws-account-ids <value>
--actions <value>
[--cli-input-json | --cli-input-yaml]
[--generate-cli-skeleton <value>]

Options

  • –queue-url (string): The Amazon SQS queue to which permissions are added, as well as its URL. The names and URLs of queues are case-sensitive.
  • –label (string): The permission you’re granting has a unique identifier (for example, AliceSendMessage ). There is a limit of 80 characters. Alphanumeric characters, hyphens (-), and underscores (_) are all permitted.
  • –aws-account-ids (list): The principals’ Amazon Web Services account numbers who will be granted permission. For information on where to find the Amazon Web Services account ID.
  • –actions (list): The action that the client wants the specified principal to be able to perform. The name of any action or “*” are valid values. When you specify SendMessage, DeleteMessage, or ChangeMessageVisibility for ActionName.n, you’ll also get access to the batch versions of those actions: SendMessageBatch, DeleteMessageBatch, and ChangeMessageVisibilityBatch.
  • –cli-input-json | –cli-input-yaml (string):Reads arguments from the provided JSON string. The JSON string is formatted using the —generate-cli-skeleton format. If any other arguments are given on the command line, they will take precedence over the JSON values. Because the string will be taken literally, it is not possible to pass arbitrary binary values using a JSON-provided value. This command should not be used with —cli-input-yaml.
  • –generate-cli-skeleton (string): Without making an API request, prints a JSON skeleton to standard output. Prints a sample input JSON that can be used as an argument for —cli-input-json if no value is provided or if the value is input. Similarly, yaml-input will print a sample YAML input that can be used with —cli-input-yaml if it is provided. It validates command inputs and returns a sample output JSON for that command if the value output is provided.

This is what syntax would look like:

"string" "string" …

Example

This example allows the AWS account to send messages to the queue specified. It demonstrates how to add permission to the queue.

aws sqs add-permission --queue-url https://sqs.us-east-1.amazonaws.com/80398EXAMPLE/MyQueue --label SendMessagesFromMyQueue --aws-account-ids 12345EXAMPLE --actions SendMessage

AWS CLI SQS: change-message-visibility

This command in AWS CLI SQS sets a new value for the visibility timeout of a specified message in a queue. A message’s visibility timeout is set to 30 seconds by default. 0 seconds is the bare minimum. The maximum amount of time allowed is 12 hours.

Assume you have a message with a visibility timeout of five minutes. You call ChangeMessageVisibility with a 10-minute timeout after 3 minutes. To extend the visibility timeout to the maximum allowed time, keep calling ChangeMessageVisibility. Your request will be rejected if you try to extend the visibility timeout beyond the maximum.

When a message is sent to a queue by a producer but not yet received from the queue by a consumer, it is considered to be stored (that is, between states 1 and 2). There is no limit to the number of messages that can be saved. When a message is received from a queue by a consumer but not yet deleted from the queue, it is considered to be in flight (that is, between states 2 and 3). There is a limit to how many in-flight messages you can send.

Limits on in-flight messages have nothing to do with the unlimited number of stored messages.

Some things to keep in mind while using this command are:

  • Amazon SQS returns an error if you try to set the VisibilityTimeout to a value greater than the maximum time left. The timeout on Amazon SQS is not automatically recalculated and increased to the maximum remaining time.
  • When you change the visibility timeout for a specific message, unlike with a queue, the value is applied immediately and not saved in memory for that message. If you don’t delete a message after it’s been received, the message’s visibility timeout reverts to the original value (rather than the value you set using the ChangeMessageVisibility action) the next time it’s received.

Synopsis

change-message-visibility
--queue-url <value>
--receipt-handle <value>
--visibility-timeout <value>
[--cli-input-json | --cli-input-yaml]
[--generate-cli-skeleton <value>]

Options

  • –receipt-handle (string): The receipt handle for the message whose visibility timeout has been extended. The ” ReceiveMessage ” action returns this parameter.
  • –visibility-timeout (integer): The message’s visibility timeout has a new value (in seconds). The values range from 0 to 43200. Maximum duration: 12 hours.

Example

The timeout visibility for the specified message is set to 10 hours (10 hours * 60 minutes * 60 seconds) in this example.

aws sqs change-message-visibility --queue-url https://sqs.us-east-1.amazonaws.com/80398EXAMPLE/MyQueue --receipt-handle AQEBTpyI...t6HyQg== --visibility-timeout 36000

AWS CLI SQS: create-queue

This command in AWS CLI SQS creates a new FIFO or standard queue. In the request, you can include one or more attributes. Keep in mind the following:

  • If the FifoQueue attribute is not specified, Amazon SQS creates a standard queue.
  • If you don’t specify a value for an attribute, the queue will be created with the attribute’s default value.
  • You must wait at least 60 seconds after deleting a queue before creating another with the same name.

To create a new queue successfully, you must provide a queue name that adheres to the queue limits and is unique within the scope of your queues.

Synopsis

 create-queue
--queue-name <value>
[--attributes <value>]
[--tags <value>]
[--cli-input-json | --cli-input-yaml]
[--generate-cli-skeleton <value>]

Options

  • –attributes(map): A list of attributes and their associated values.
  • –tags (map): To the specified Amazon SQS queue, add cost allocation tags. It’s not a good idea to add more than 50 tags to a queue. Tags are semantically meaningless. Tags are interpreted as character strings by Amazon SQS. Case matters when it comes to tags. A new tag with the same key as an existing tag will overwrite the existing tag.

Shorthand Syntax:

KeyName1=string,KeyName2=string

JSON Syntax:

{"string": "string"
  ...}

Example

This example creates a queue with the given name, sets the message retention period to three days (3 days * 24 hours * 60 minutes * 60 seconds), and assigns the queue’s dead letter queue to the given queue with a maximum receive count of 1,000 messages.

aws sqs create-queue --queue-name MyQueue --attributes file://create-queue.json

Input file (create-queue.json):

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

Output

{
  "QueueUrl": "https://queue.amazonaws.com/80398EXAMPLE/MyQueue"

OUTPUT:

QueueUrl -> (string) The created Amazon SQS queue’s URL.

AWS CLI SQS: delete-message

This command in AWS CLI SQS removes a specified message from the specified queue. Use the message’s ReceiptHandle to select the message to delete (not the MessageId which you receive when you send the message). Even if a message is locked by another consumer in AWS CLI SQS due to a visibility timeout setting, Amazon SQS can delete it from the queue. Amazon SQS deletes messages that have been in a queue for longer than the queue’s retention period.

Some things to keep in mind while using this command are:

  • The ReceiptHandle is linked to a specific message receiving instance. The ReceiptHandle changes each time you receive a message if you receive it more than once. You must provide the most recently received ReceiptHandle for the message when using the DeleteMessage action (otherwise, the request succeeds, but the message might not be deleted).
  • Even if you delete a message from a standard queue, it is possible to receive it again. If one of the servers that store a copy of the message is unavailable when you send the request to delete the message, this may happen on rare occasions. The copy is kept on the server and may be returned to you when you make another receive request. You should make sure that your application is idempotent, which means that receiving a message multiple times won’t cause any problems.

Synopsis

 delete-message
--queue-url <value>
--receipt-handle <value>
[--cli-input-json | --cli-input-yaml]
[--generate-cli-skeleton <value>]

Options

  • –receipt-handle (string): The receipt handle for the message to be deleted.

Example

This example removes the specified message from the system.

aws sqs delete-message --queue-url https://sqs.us-east-1.amazonaws.com/80398EXAMPLE/MyQueue --receipt-handle AQEBRXTo...q2doVA==

AWS CLI SQS: delete-queue

This command in AWS CLI SQS deletes the queue specified by the QueueUrl, regardless of its content.

Some things to keep in mind while using this command:

  • Keep in mind that if you use the DeleteQueue action, any messages in the queue will be deleted as well.

When you delete a queue, it can take up to 60 seconds to complete. During the 60 seconds, you might be able to send requests to that queue. 

For example, a “ SendMessage “ request might succeed, but the queue and the message you sent will be gone after 60 seconds.

You must wait at least 60 seconds after deleting a queue before creating another with the same name.

Synopsis

delete-queue
--queue-url <value>
[--cli-input-json | --cli-input-yaml]
[--generate-cli-skeleton <value>]

Options

  • –queue-url (string): The Amazon SQS queue you want to delete’s URL. The case is important in queue URLs and names.

Example

The specified queue is deleted in this example.

aws sqs delete-queue --queue-url https://sqs.us-east-1.amazonaws.com/80398EXAMPLE/MyNewerQueue

AWS CLI SQS: get-queue-url

The URL of an existing Amazon SQS queue is returned using this command in AWS CLI SQS.

Use the QueueOwnerAWSAccountId parameter to specify the account ID of the queue’s owner to access a queue that belongs to another AWS account. The owner of the queue must permit you to join it.

Synopsis

get-queue-url
--queue-name <value>
[--queue-owner-aws-account-id <value>]
[--cli-input-json | --cli-input-yaml]
[--generate-cli-skeleton <value>]

Options

  • –queue-name (string): The name of the queue for which the URL needs to be retrieved. There is a limit of 80 characters. Alphanumeric characters, hyphens (-), and underscores (_) are all valid values. The names and URLs of queues are case-sensitive.
  • –queue-owner-aws-account-id (string): The account ID of the account that created the queue on Amazon Web Services.

Example

The URL of the specified queue is obtained in this example:

aws sqs get-queue-url --queue-name MyQueue

Output

{
  "QueueUrl": "https://queue.amazonaws.com/80398EXAMPLE/MyQueue"
}

OUTPUT:

QueueUrl -> (string) The queue’s URL.

AWS CLI SQS: receive-message

This command in AWS CLI SQS enables the specified queue to be used to retrieve one or more messages (up to ten). Long-poll support is enabled by the WaitTimeSeconds parameter.

A weighted random set of machines is sampled on a ReceiveMessage call in the short poll mode, which is the default behavior. As a result, only the messages from the machines that have been sampled are returned. If there are fewer than 1,000 messages in the queue, you will most likely receive fewer messages per ReceiveMessage call than you requested. You might not receive any messages in a particular ReceiveMessage response if the number of messages in the queue is extremely small. Repeat the request if this happens.

The following information is included in the response for each message:

  • The body of the message.
  • The message body’s MD5 digest. RFC1321 contains information on MD5.
  • When you sent the message to the queue, you were given a MessageId.
  • The handle on the receipt.
  • The attributes of the message.
  • The attributes of the message are MD5 digested.

Some things to keep in mind while using this command are:

  • When deleting a message, you must provide the receipt handle as an identifier. The VisibilityTimeout parameter can be included in your request. The parameter affects the messages returned by Amazon SQS in the response. If you don’t include the parameter, the returned messages will use the queue’s overall visibility timeout.
  • A failed receive is defined as a message that has not been deleted or whose visibility has not been extended before the visibility timeout expires. The message might be sent to the dead-letter queue, depending on the queue’s configuration.

Synopsis

receive-message
--queue-url <value>
[--attribute-names <value>]
[--message-attribute-names <value>]
[--max-number-of-messages <value>]
[--visibility-timeout <value>]
[--wait-time-seconds <value>]
[--receive-request-attempt-id <value>]
[--cli-input-json | --cli-input-yaml]
[--generate-cli-skeleton <value>]

Options

  • –queue-url (string): The Amazon SQS queue from which messages are received is identified by its URL. The names and URLs of queues are case-sensitive.
  • –attribute-names (list): Each message must have a list of attributes that must be returned with it.
  • –message-attribute-names (list): The message attribute’s name, where N is the index.
    • The underscore (_), hyphen (-), and period characters are allowed in the name (. ).
    • The name must be case-sensitive and unique among all of the message’s attribute names.
    • AWS-reserved prefixes such as AWS. or Amazon must not be used in the name (or any casing variants).
    • A period (.) must not appear at the beginning or end of the name, nor should there be any periods in a row (.. ).
    • The name has a maximum length of 256 characters.  
    • When using ReceiveMessage, you can send a list of attribute names to receive, or specify All or.* in your request to return all of the attributes. All message attributes that begin with a prefix, such as bar.*, can also be used.
  • –max-number-of-messages (integer): This is the maximum number of messages that will be returned. More messages than this value are never returned by Amazon SQS (however, fewer messages might be returned). 1 to 10 are valid values. 1 is the default value.
  • –visibility-timeout (integer): After being retrieved by a ReceiveMessage request, the duration (in seconds) for which the received messages are hidden from subsequent retrieve requests.
  • –wait-time-seconds (integer): The time it takes for a message to arrive in the queue before the call returns (in seconds). The call returns faster than WaitTimeSeconds if a message is available. If no messages are available after the wait time has expired, the call is completed with an empty message list.
  • –receive-request-attempt-id (string): Only FIFO (first-in-first-out) queues are affected by this parameter. ReceiveMessage calls are deduplicated using this token. If you receive a generic error instead of a response after performing a ReceiveMessage action, you can retry the same action with an identical ReceiveRequestAttemptId to retrieve the same set of messages, even if their visibility timeout has not yet expired.

Syntax:

"string" "string" …

Example

This example receives up to ten messages and returns all of their attributes:

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

Output

{
  "Messages": [
    {
      "Body": "My first message.",
      "ReceiptHandle": "AQEBzbVv...fqNzFw==",
      "MD5OfBody": "1000f835...a35411fa",
      "MD5OfMessageAttributes": "9424c491...26bc3ae7",
      "MessageId": "d6790f8d-d575-4f01-bc51-40122EXAMPLE",
      "Attributes": {
        "ApproximateFirstReceiveTimestamp": "1442428276921",
        "SenderId": "AIDAIAZKMSNQ7TEXAMPLE",
        "ApproximateReceiveCount": "5",
        "SentTimestamp": "1442428276921"
      },
      "MessageAttributes": {
        "PostalCode": {
          "DataType": "String",
          "StringValue": "ABC123"
        },
        "City": {
          "DataType": "String",
          "StringValue": "Any City"
        }
      }
    }
  ]
}

OUTPUT:

Messages -> (list)
A list of messages.
(structure)
An Amazon SQS message.
MessageId -> (string)
The message's unique identifier. For an extended period, a MessageId is considered unique across all Amazon Web Services accounts.
ReceiptHandle -> (string)
A unique identifier for the act of receiving a message. Every time you receive a message, you will be given a new receipt handle. When deleting a message, you must provide the message's last received receipt handle.
MD5OfBody -> (string)
The MD5 digest of the message body string that isn't encoded with the URL.
Body -> (string)
The message’s contents (not URL-encoded).
Attributes -> (map)
The attributes requested in " ReceiveMessage " are mapped to their values in this map. Attributes that are supported include:
ApproximateReceiveCount
ApproximateFirstReceiveTimestamp
MessageDeduplicationId
MessageGroupId
SenderId
SentTimestamp
SequenceNumber
The epoch time in milliseconds is represented by ApproximateFirstReceiveTimestamp and SentTimestamp, which are returned as integers.
Name -> (string)
Value -> (string)
MD5OfMessageAttributes -> (string)
The MD5 digest of the message attribute string that hasn't been encoded with a URL. This attribute can be used to ensure that Amazon SQS correctly received the message. Before creating an MD5 digest, Amazon SQS URL decodes the message.
MessageAttributes -> (map)
Each message attribute consists of a Name, Type, and Value. 
Name -> (string)
Value -> (structure)
The message attribute value is specified by the user. The Value attribute has the same content restrictions as the message body for string data types.
The message body, name, type, and value must not be null or empty. The message size restriction encompasses all elements of the message attribute, including Name, Type, and Value (256 KB or 262,144 bytes).
StringValue -> (string)
Strings are Unicode with UTF-8 binary encoding. 
Any binary data, such as compressed data, encrypted data, or images, can be stored in binary type attributes.
StringListValues -> (list)
Not implemented. Reserved for future use.
(string)
BinaryListValues -> (list)
Not implemented. Reserved for future use.
(blob)
DataType -> (string)
The following logical data types are supported by Amazon SQS: String, Number, and Binary. StringValue is required for the Number data type.
Custom labels can also be added.

AWS CLI SQS: send-message

This sends a message to the queue specified.

Only XML, JSON, and unformatted text are allowed in a message. #x9 | #xA | #xD | #x20 to #xD7FF | #xE000 to #xFFFD | #x10000 to  #x10FFFF Unicode characters are allowed.

Characters that do not appear on this list will be rejected.

Synopsis

send-message
--queue-url <value>
--message-body <value>
[--delay-seconds <value>]
[--message-attributes <value>]
[--message-system-attributes <value>]
[--message-deduplication-id <value>]
[--message-group-id <value>]
[--cli-input-json | --cli-input-yaml]
[--generate-cli-skeleton <value>]

Options

  • –queue-url (string): The Amazon SQS queue to which a message is delivered. The names and URLs of queues are case-sensitive.
  • –message-body (string): The message that should be sent. One character is the smallest size. The file size limit is 256 KB.
  • –delay-seconds (integer): The amount of time, in seconds, that a message should be delayed. 0 to 900 are valid values. Time limit: 15 minutes. After the delay period is over, messages with a positive DelaySeconds value become available for processing. If you don’t specify a value, the queue’s default value is used.
  • –message-attributes (map): Each message attribute has three parts: a Name, a Type, and a Value.
  • –message-system-attributes (map): The attribute of the message system to send. A Name, Type, and Value are assigned to each message system attribute.
  • –message-deduplication-id (string): Only FIFO (first-in-first-out) queues are affected by this parameter. The token is used to prevent duplicate messages from being sent. Any messages sent with the same MessageDeduplicationId are accepted successfully but not delivered during the 5-minute deduplication interval if a message with that MessageDeduplicationId is sent successfully.
  • –message-group-id (string): Only FIFO (first-in, first-out) queues are affected by this parameter. The tag indicates whether or not a message is part of a specific message group. FIFO processing is used to process messages that belong to the same message group (however, messages in different message groups might be processed out of order). Use MessageGroupId values in a single queue to interleave multiple ordered streams (for example, session data for multiple users). Multiple consumers can process the queue in this scenario, but each user’s session data is processed FIFO.

Shorthand Syntax:

KeyName1=StringValue=string,BinaryValue=blob,StringListValues=string,string,BinaryListValues=blob,blob,DataType=string,KeyName2=StringValue=string,BinaryValue=blob,StringListValues=string,string,BinaryListValues=blob,blob,DataType=string

Where valid key names are:
  AWSTraceHeader

JSON Syntax:

{"AWSTraceHeader": {
      "StringValue": "string",
      "BinaryValue": blob,
      "StringListValues": ["string", ...],
      "BinaryListValues": [blob, ...],
      "DataType": "string"
    }
  ...}

Example

This example sends a message to the specified queue, with the specified message body, delay period, and message attributes.

aws sqs send-message --queue-url https://sqs.us-east-1.amazonaws.com/80398EXAMPLE/MyQueue --message-body "Information about the largest city in Any Region." --delay-seconds 10 --message-attributes file://send-message.json

Input file (send-message.json):

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

Output

{
  "MD5OfMessageBody": "51b0a325...39163aa0",
  "MD5OfMessageAttributes": "00484c68...59e48f06",
  "MessageId": "da68f62c-0c07-4bee-bf5f-7e856EXAMPLE"
}

OUTPUT:

MD5OfMessageBody -> (string)
The MD5 digest of the message body string that is not URL encoded. This attribute can be used to check that Amazon SQS received the message correctly. Before generating the MD5 digest, Amazon SQS URL decodes the message.
MD5OfMessageAttributes -> (string)
The non-URL-encoded message attribute string's MD5 digest. This attribute can be used to ensure that Amazon SQS received the message correctly. Before creating the MD5 digest, Amazon SQS URL decodes the message.
MD5OfMessageSystemAttributes -> (string)
The MD5 digest of the message system attribute string that is not encoded with a URL. This attribute can be used to ensure that Amazon SQS correctly received the message. Before creating an MD5 digest, Amazon SQS URL decodes the message.
MessageId -> (string)
The MessageId of the message sent to the queue is stored in this attribute.
SequenceNumber -> (string)
Only FIFO (first-in-first-out) queues are affected by this parameter.
Each message is assigned a large, non-consecutive number by Amazon SQS.
SequenceNumber has a length of 128 bits. For a given MessageGroupId, the SequenceNumber keeps increasing.

Conclusion

This blog talks about the working of AWS CLI SQS and how messages can be sent and received using the AWS command-line interface. It also describes the key benefits of AWS SQS.

Master the use of AWS SQS’s DeleteMessage feature to efficiently manage your message queue. Learn more about its functionality in SQS DeleteMessage.

Hevo Data, a No-code Data Pipeline provides you with a consistent and reliable solution to manage data transfer between a variety of sources and a wide variety of Desired Destinations, with a few clicks. Hevo Data with its strong integration with 150+ sources (including 60+ free sources) allows you to not only export data from your desired data sources & load it to the destination of your choice, but also transform & enrich your data to make it analysis-ready so that you can focus on your key business needs and perform insightful analysis.

Want to take Hevo for a spin? Sign Up for a 14-day free trial and experience the feature-rich Hevo suite first hand. You can also have a look at the unbeatable pricing that will help you choose the right plan for your business needs.

FAQs

1. How to access AWS SQs?

To access AWS SQS, you can use the AWS Management Console, AWS CLI, or AWS SDKs. Through these interfaces, you can create, manage, and send or receive messages from SQS queues by authenticating with your AWS account credentials.

2. Is AWS SQS the same as Kafka?

No, AWS SQS and Kafka are different. AWS SQS is a fully managed message queuing service that supports decoupling applications and ensuring message delivery. Kafka, on the other hand, is a distributed streaming platform designed for real-time data streams, offering more advanced features for high-throughput and low-latency messaging.

3. How to send message to AWS SQS queue?

To send a message to an AWS SQS queue, you can use the AWS Management Console, AWS CLI, or an SDK. With the AWS CLI, use the aws sqs send-message command, specifying the queue URL and the message body, like this: aws sqs send-message –queue-url <QueueURL> –message-body “Your message”.

4. Is SQS like RabbitMQ?

Yes, SQS and RabbitMQ are similar in that both are message brokers used for decoupling application components. However, SQS is a fully managed service provided by AWS with built-in scalability and reliability, while RabbitMQ is an open-source message broker that requires self-management and deployment. SQS is more cloud-native, whereas RabbitMQ offers more advanced routing and queuing features for on-premise or hybrid environments.

Harshitha Balasankula
Marketing Content Analyst, Hevo Data

Harshitha is a dedicated data analysis fanatic with a strong passion for data, software architecture, and technical writing. Her commitment to advancing the field motivates her to produce comprehensive articles on a wide range of topics within the data industry.