AWS - SQS

Use the AWS Simple Queue Service (SQS) integration to receive the messages from the queue.

This integration was integrated and tested with API Version 2012-11-05.

Prerequisites

It is important that you familiarize yourself with and complete all steps detailed in the Amazon AWS Integrations Configuration Guide .

Configure the AWS SQS Integration in Demisto

  1. Navigate to Settings > Integrations > Servers & Services .
  2. Search for the SQS integration.
  3. Click Add instance to create and configure a new integration.
  • Name : a textual name for the integration instance.
  • AWS Default Region
  • Role Arn
  • Role Session Name
  • Fetch incidents
  • Role Session Duration
  • QueueURL : the relevant URL is under the Details tab.

Fetched Incidents Data

New messages from the queue are fetched.

Commands

You can execute these commands from the Demisto CLI, as part of an automation, or in a playbook. After you successfully execute a command, a DBot message appears in the War Room with the command details.

  1. Get a queue URL: aws-sqs-get-queue-url
  2. List all queues: aws-sqs-list-queues
  3. Send a message: aws-sqs-send-message
  4. Create a queue: aws-sqs-create-queue
  5. Delete a queue: aws-sqs-delete-queue
  6. Delete messages from a queue: aws-sqs-purge-queue

Get a queue URL: aws-sqs-get-queue-url

Return the URL of a queue.

Command Example

!aws-sqs-get-queue-url queueName=test

AWS IAM Policy Permission

Effect: Allow
Action: sqs:GetQueueUrl

Input
Parameter Description
queueName The name of the queue
queueOwnerAWSAccountId The AWS account ID of the account that created the queue
region AWS region (if not specified, the default region is used)
roleArn Amazon Resource Name of the role to assum
roleSessionName An identifier for the assumed role session
roleSessionDuration The duration, in seconds, of the role session. The value can range from 900 seconds to the maximum session duration setting for the role.

Context Output
Path Description
AWS.SQS.Queues.QueueUrl The URL of the queue

Raw Output
{  
   "QueueUrl":"https://eu-central-1.queue.amazonaws.com/123456789/test"
}

List all queues: aws-sqs-list-queues

List all Amazon SQS queues.

Command Example

!aws-sqs-list-queues

AWS IAM Policy Permission

Effect: Allow
Action: sqs:ListQueues

Input
Parameter Description
queueNamePrefix A string to use for filtering the list results. Only queues whose name begins with the specified string are returned. Queue names are case-sensitive.
queueOwnerAWSAccountId The AWS account ID of the account that created the queue
region AWS region (if not specified, the default region is used)
roleArn Amazon Resource Name of the role to assum
roleSessionName An identifier for the assumed role session
roleSessionDuration The duration, in seconds, of the role session. The value can range from 900 seconds to the maximum session duration setting for the role.

Context Output
Path Description
AWS.SQS.Queues.QueueUrl The URL of the queue

Raw Output
[  
   {  
      "QueueUrl":"https://eu-central-1.queue.amazonaws.com/123456789/test"
   },
   {  
      "QueueUrl":"https://eu-central-1.queue.amazonaws.com/123456789/test2"
   }
]

Send a message: aws-sqs-send-message

Send a message to an Amazon SQS queue.

Command Example

!aws-sqs-send-message queueUrl=https://eu-central-1.queue.amazonaws.com/123456789/test messageBody="test"

AWS IAM Policy Permission

Effect: Allow
Action: sqs:SendMessage

Input
Parameter Description
queueUrl The URL of the Amazon SQS queue to which a message is sent
messageBody The message to send (maximum string size is 256 KB)
delaySeconds The length of time, in seconds, to delay a specific message. Valid values: 0 to 900.
messageGroupId This parameter applies only to FIFO queues. The tag that specifies that a message belongs to a specific message group.
region AWS region (if not specified, the default region is used)
roleArn Amazon Resource Name of the role to assum
roleSessionName An identifier for the assumed role session
roleSessionDuration The duration, in seconds, of the role session. The value can range from 900 seconds to the maximum session duration setting for the role.

Context Output
Path Description
AWS.SQS.Queues.SentMessages.MD5OfMessageBody An MD5 digest of the non-URL-encoded message attribute string
AWS.SQS.Queues.SentMessages.MD5OfMessageAttributes An MD5 digest of the non-URL-encoded message attribute string
AWS.SQS.Queues.SentMessages.MessageId An attribute containing the MessageId of the message sent to the queue
AWS.SQS.Queues.SentMessages.SequenceNumber This parameter applies only to FIFO (first-in-first-out) queues. The large, non-consecutive number that Amazon SQS assigns to each message.

Raw Output
{  
   "MD5OfMessageBody":"098f6asdfbcd4621d3asd73cdsfade4e832627b4f6",
   "MessageId":"c54abasb01-c353-4810-a434-a9aadf233fa68f",
   "QueueUrl":"https://eu-central-1.queue.amazonaws.com/123456789/test"
}

Create a queue: aws-sqs-create-queue

Create a queue in Amazon SQS.

Command Example

!aws-sqs-create-queue queueName=test3

AWS IAM Policy Permission

Effect: Allow
Action: sqs:CreateQueue

Input
Parameter Description
queueName The name of the new queue. The following limits apply to this name: A queue name can have up to 80 characters. Valid values: alphanumeric characters, hyphens (- ), and underscores (_ ). A FIFO queue name must end with the .fifo suffix. Queue names are case-sensitive.
delaySeconds The length of time, in seconds, to delay a specific message. Valid values: 0 to 900, the default is 0.
maximumMessageSize The limit of how many bytes a message can contain before Amazon SQS rejects it. Valid values: An integer from 1,024 bytes (1 KiB) to 262,144 bytes (256 KiB). The default is 262,144 (256 KiB).
messageRetentionPeriod The length of time, in seconds, for which Amazon SQS retains a message. Valid values: An integer from 60 seconds (1 minute) to 1,209,600 seconds (14 days). The default is 345,600 (4 days).
receiveMessageWaitTimeSeconds The length of time, in seconds, for which a ReceiveMessage action waits for a message to arrive. Valid values: An integer from 0 to 20 (seconds). The default is 0.
visibilityTimeout The visibility timeout for the queue. Valid values: An integer from 0 to 43,200 (12 hours). The default is 30.
kmsDataKeyReusePeriodSeconds The length of time, in seconds, for which Amazon SQS can reuse a data key to encrypt or decrypt messages before calling AWS KMS again. An integer representing seconds, between 60 seconds (1 minute) and 86,400 seconds (24 hours). The default is 300 (5 minutes). A shorter time period provides better security but results in more calls to KMS which might incur charges after Free Tier.
kmsMasterKeyId The ID of an AWS-managed customer master key (CMK) for Amazon SQS or a custom CMK
policy The queue's policy. A valid AWS policy.
fifoQueue Designates a queue as FIFO
contentBasedDeduplication Enables content-based deduplication
region AWS region (if not specified, the default region is used)
roleArn Amazon Resource Name of the role to assum
roleSessionName An identifier for the assumed role session
roleSessionDuration The duration, in seconds, of the role session. The value can range from 900 seconds to the maximum session duration setting for the role.

Context Output
Path Description
AWS.SQS.Queues.QueueUrl The URL of the created Amazon SQS queue

Raw Output
{  
   "QueueUrl":"https://eu-central-1.queue.amazonaws.com/123456789/test3"
}

Delete a queue: aws-sqs-delete-queue

Deletes a queue from Amazon SQS.

Command Example

!aws-sqs-delete-queue queueUrl=https://eu-central-1.queue.amazonaws.com/123456789/test3

AWS IAM Policy Permission

Effect: Allow
Action: sqs:DeleteQueue

Input
Parameter Description
queueUrl The URL of the Amazon SQS queue to delete
region AWS region (if not specified, the default region is used)
roleArn Amazon Resource Name of the role to assum
roleSessionName An identifier for the assumed role session
roleSessionDuration The duration, in seconds, of the role session. The value can range from 900 seconds to the maximum session duration setting for the role.

Context Output

There is no context output for this command.

Raw Output
The Queue was deleted.

Delete messages from a queue: aws-sqs-purge-queue

Deletes messages from a specified queue in Amazon SQS.

Command Example

!aws-sqs-purge-queue queueUrl=aws-sqs-delete-queue queueUrl=https://eu-central-1.queue.amazonaws.com/123456789/test2

AWS IAM Policy Permission

Effect: Allow
Action: sqs:PurgeQueue

Input
Parameter Description
queueUrl The URL of the queue from which the PurgeQueue action deletes messages
region AWS region (if not specified, the default region is used)
roleArn Amazon Resource Name of the role to assum
roleSessionName An identifier for the assumed role session
roleSessionDuration The duration, in seconds, of the role session. The value can range from 900 seconds to the maximum session duration setting for the role.

Context Output

There is no context output for this command.

Raw Output
The Queue was purged.