This documentation is for the developer preview release of the AWS CDK. Do not use this version of the AWS CDK in production. Subsequent releases of the AWS CDK will likely include breaking changes.

@aws-cdk/aws-sqs

AWS SQS Construct Library

Amazon Simple Queue Service (SQS) is a fully managed message queuing service that enables you to decouple and scale microservices, distributed systems, and serverless applications. SQS eliminates the complexity and overhead associated with managing and operating message oriented middleware, and empowers developers to focus on differentiating work. Using SQS, you can send, store, and receive messages between software components at any volume, without losing messages or requiring other services to be available.

Installation

Import to your project:

import sqs = require('@aws-cdk/aws-sqs');

Basic usage

Here’s how to add a basic queue to your application:

new sqs.Queue(this, 'Queue');

Encryption

If you want to encrypt the queue contents, set the encryption property. You can have the messages encrypted with a key that SQS manages for you, or a key that you can manage yourself.

// Use managed key
new sqs.Queue(this, 'Queue', {
    encryption: QueueEncryption.Managed,
});

// Use custom key
const myKey = new EncryptionKey(this, 'Key');

new sqs.Queue(this, 'Queue', {
    encryption: QueueEncryption.Kms,
    encryptionMasterKey: myKey
});

First-In-First-Out (FIFO) queues

FIFO queues give guarantees on the order in which messages are dequeued, and have additional features in order to help guarantee exactly-once processing. For more information, see the SQS manual. Note that FIFO queues are not available in all AWS regions.

A queue can be made a FIFO queue by either setting fifo: true, giving it a name which ends in ".fifo", or enabling content-based deduplication (which requires FIFO queues).

Reference

View in Nuget

csproj:

<PackageReference Include="Amazon.CDK.AWS.SQS" Version="0.24.1" />

dotnet:

dotnet add package Amazon.CDK.AWS.SQS --version 0.24.1

packages.config:

<package id="Amazon.CDK.AWS.SQS" version="0.24.1" />

View in Maven Central

Apache Buildr:

'software.amazon.awscdk:sqs:jar:0.24.1'

Apache Ivy:

<dependency groupId="software.amazon.awscdk" name="sqs" rev="0.24.1"/>

Apache Maven:

<dependency>
  <groupId>software.amazon.awscdk</groupId>
  <artifactId>sqs</artifactId>
  <version>0.24.1</version>
</dependency>

Gradle / Grails:

compile 'software.amazon.awscdk:sqs:0.24.1'

Groovy Grape:

@Grapes(
@Grab(group='software.amazon.awscdk', module='sqs', version='0.24.1')
)

View in NPM

npm:

$ npm i @aws-cdk/aws-sqs@0.24.1

package.json:

{
  "@aws-cdk/aws-sqs": "^0.24.1"
}

yarn:

$ yarn add @aws-cdk/aws-sqs@0.24.1

View in NPM

npm:

$ npm i @aws-cdk/aws-sqs@0.24.1

package.json:

{
  "@aws-cdk/aws-sqs": "^0.24.1"
}

yarn:

$ yarn add @aws-cdk/aws-sqs@0.24.1

CfnQueue

class @aws-cdk/aws-sqs.CfnQueue(scope, id[, props])

Language-specific names:

using Amazon.CDK.AWS.SQS;
import software.amazon.awscdk.services.sqs.CfnQueue;
const { CfnQueue } = require('@aws-cdk/aws-sqs');
import { CfnQueue } from '@aws-cdk/aws-sqs';
Extends:

@aws-cdk/cdk.Resource

Parameters:
  • scope (@aws-cdk/cdk.Construct) – scope in which this resource is defined
  • id (string) – scoped id of the resource
  • props (CfnQueueProps (optional)) – resource properties
renderProperties(properties) → string => any

Overrides @aws-cdk/cdk.Resource.renderProperties()

Protected method

Parameters:properties (any) –
Return type:string => any
resourceTypeName

The CloudFormation resource type name for this resource class.

Type:string (readonly) (static)
propertyOverrides
Type:CfnQueueProps (readonly)
queueArn
Type:string (readonly)
queueName
Type:string (readonly)
queueUrl
Type:string (readonly)
tags

The TagManager handles setting, removing and formatting tags

Tags should be managed either passing them as properties during

initiation or by calling methods on this object. If both techniques are

used only the tags from the TagManager will be used. Tag (aspect)

will use the manager.

Type:@aws-cdk/cdk.TagManager (readonly)
apply(aspect)

Inherited from @aws-cdk/cdk.Construct

Applies the aspect to this Constructs node

Parameters:aspect (@aws-cdk/cdk.IAspect) –
toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:@aws-cdk/cdk.ConstructNode (readonly)
ref

Inherited from @aws-cdk/cdk.Referenceable

Returns a token to a CloudFormation { Ref } that references this entity based on it’s logical ID.

Type:string (readonly)
addDeletionOverride(path)

Inherited from @aws-cdk/cdk.Resource

Syntactic sugar for addOverride(path, undefined).

Parameters:path (string) – The path of the value to delete
addDependsOn(resource)

Inherited from @aws-cdk/cdk.Resource

Indicates that this resource depends on another resource and cannot be provisioned

unless the other resource has been successfully provisioned.

Parameters:resource (@aws-cdk/cdk.Resource) –
addOverride(path, value)

Inherited from @aws-cdk/cdk.Resource

Adds an override to the synthesized CloudFormation resource. To add a

property override, either use addPropertyOverride or prefix path with

“Properties.” (i.e. Properties.TopicName).

Parameters:
  • path (string) – The path of the property, you can use dot notation to override values in complex types. Any intermdediate keys will be created as needed.
  • value (any) – The value. Could be primitive or complex.
addPropertyDeletionOverride(propertyPath)

Inherited from @aws-cdk/cdk.Resource

Adds an override that deletes the value of a property from the resource definition.

Parameters:propertyPath (string) – The path to the property.
addPropertyOverride(propertyPath, value)

Inherited from @aws-cdk/cdk.Resource

Adds an override to a resource property.

Syntactic sugar for addOverride(“Properties.<…>”, value).

Parameters:
  • propertyPath (string) – The path of the property
  • value (any) – The value
getAtt(attributeName) → @aws-cdk/cdk.CfnReference

Inherited from @aws-cdk/cdk.Resource

Returns a token for an runtime attribute of this resource.

Ideally, use generated attribute accessors (e.g. resource.arn), but this can be used for future compatibility

in case there is no generated attribute.

Parameters:attributeName (string) – The name of the attribute.
Return type:@aws-cdk/cdk.CfnReference
toCloudFormation() → json

Inherited from @aws-cdk/cdk.Resource

Emits CloudFormation for this resource.

Return type:json
options

Inherited from @aws-cdk/cdk.Resource

Options for this resource, such as condition, update policy etc.

Type:@aws-cdk/cdk.ResourceOptions (readonly)
properties

Inherited from @aws-cdk/cdk.Resource

AWS resource properties.

This object is rendered via a call to “renderProperties(this.properties)”.

Protected property

Type:any (readonly)
resourceType

Inherited from @aws-cdk/cdk.Resource

AWS resource type.

Type:string (readonly)
untypedPropertyOverrides

Inherited from @aws-cdk/cdk.Resource

AWS resource property overrides.

During synthesis, the method “renderProperties(this.overrides)” is called

with this object, and merged on top of the output of

“renderProperties(this.properties)”.

Derived classes should expose a strongly-typed version of this object as

a public property called propertyOverrides.

Protected property

Type:any (readonly)
overrideLogicalId(newLogicalId)

Inherited from @aws-cdk/cdk.StackElement

Overrides the auto-generated logical ID with a specific ID.

Parameters:newLogicalId (string) – The new logical ID to use for this stack element.
prepare()

Inherited from @aws-cdk/cdk.StackElement

Automatically detect references in this StackElement

Protected method

creationStackTrace

Inherited from @aws-cdk/cdk.StackElement

Type:string[] (readonly)
logicalId

Inherited from @aws-cdk/cdk.StackElement

The logical ID for this CloudFormation stack element. The logical ID of the element

is calculated from the path of the resource node in the construct tree.

To override this value, use overrideLogicalId(newLogicalId).

Type:string (readonly)
stackPath

Inherited from @aws-cdk/cdk.StackElement

Return the path with respect to the stack

Type:string (readonly)
stack

Inherited from @aws-cdk/cdk.StackElement

The stack this Construct has been made a part of

Protected property

Type:@aws-cdk/cdk.Stack

CfnQueuePolicy

class @aws-cdk/aws-sqs.CfnQueuePolicy(scope, id, props)

Language-specific names:

using Amazon.CDK.AWS.SQS;
import software.amazon.awscdk.services.sqs.CfnQueuePolicy;
const { CfnQueuePolicy } = require('@aws-cdk/aws-sqs');
import { CfnQueuePolicy } from '@aws-cdk/aws-sqs';
Extends:

@aws-cdk/cdk.Resource

Parameters:
renderProperties(properties) → string => any

Overrides @aws-cdk/cdk.Resource.renderProperties()

Protected method

Parameters:properties (any) –
Return type:string => any
resourceTypeName

The CloudFormation resource type name for this resource class.

Type:string (readonly) (static)
propertyOverrides
Type:CfnQueuePolicyProps (readonly)
apply(aspect)

Inherited from @aws-cdk/cdk.Construct

Applies the aspect to this Constructs node

Parameters:aspect (@aws-cdk/cdk.IAspect) –
toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:@aws-cdk/cdk.ConstructNode (readonly)
ref

Inherited from @aws-cdk/cdk.Referenceable

Returns a token to a CloudFormation { Ref } that references this entity based on it’s logical ID.

Type:string (readonly)
addDeletionOverride(path)

Inherited from @aws-cdk/cdk.Resource

Syntactic sugar for addOverride(path, undefined).

Parameters:path (string) – The path of the value to delete
addDependsOn(resource)

Inherited from @aws-cdk/cdk.Resource

Indicates that this resource depends on another resource and cannot be provisioned

unless the other resource has been successfully provisioned.

Parameters:resource (@aws-cdk/cdk.Resource) –
addOverride(path, value)

Inherited from @aws-cdk/cdk.Resource

Adds an override to the synthesized CloudFormation resource. To add a

property override, either use addPropertyOverride or prefix path with

“Properties.” (i.e. Properties.TopicName).

Parameters:
  • path (string) – The path of the property, you can use dot notation to override values in complex types. Any intermdediate keys will be created as needed.
  • value (any) – The value. Could be primitive or complex.
addPropertyDeletionOverride(propertyPath)

Inherited from @aws-cdk/cdk.Resource

Adds an override that deletes the value of a property from the resource definition.

Parameters:propertyPath (string) – The path to the property.
addPropertyOverride(propertyPath, value)

Inherited from @aws-cdk/cdk.Resource

Adds an override to a resource property.

Syntactic sugar for addOverride(“Properties.<…>”, value).

Parameters:
  • propertyPath (string) – The path of the property
  • value (any) – The value
getAtt(attributeName) → @aws-cdk/cdk.CfnReference

Inherited from @aws-cdk/cdk.Resource

Returns a token for an runtime attribute of this resource.

Ideally, use generated attribute accessors (e.g. resource.arn), but this can be used for future compatibility

in case there is no generated attribute.

Parameters:attributeName (string) – The name of the attribute.
Return type:@aws-cdk/cdk.CfnReference
toCloudFormation() → json

Inherited from @aws-cdk/cdk.Resource

Emits CloudFormation for this resource.

Return type:json
options

Inherited from @aws-cdk/cdk.Resource

Options for this resource, such as condition, update policy etc.

Type:@aws-cdk/cdk.ResourceOptions (readonly)
properties

Inherited from @aws-cdk/cdk.Resource

AWS resource properties.

This object is rendered via a call to “renderProperties(this.properties)”.

Protected property

Type:any (readonly)
resourceType

Inherited from @aws-cdk/cdk.Resource

AWS resource type.

Type:string (readonly)
untypedPropertyOverrides

Inherited from @aws-cdk/cdk.Resource

AWS resource property overrides.

During synthesis, the method “renderProperties(this.overrides)” is called

with this object, and merged on top of the output of

“renderProperties(this.properties)”.

Derived classes should expose a strongly-typed version of this object as

a public property called propertyOverrides.

Protected property

Type:any (readonly)
overrideLogicalId(newLogicalId)

Inherited from @aws-cdk/cdk.StackElement

Overrides the auto-generated logical ID with a specific ID.

Parameters:newLogicalId (string) – The new logical ID to use for this stack element.
prepare()

Inherited from @aws-cdk/cdk.StackElement

Automatically detect references in this StackElement

Protected method

creationStackTrace

Inherited from @aws-cdk/cdk.StackElement

Type:string[] (readonly)
logicalId

Inherited from @aws-cdk/cdk.StackElement

The logical ID for this CloudFormation stack element. The logical ID of the element

is calculated from the path of the resource node in the construct tree.

To override this value, use overrideLogicalId(newLogicalId).

Type:string (readonly)
stackPath

Inherited from @aws-cdk/cdk.StackElement

Return the path with respect to the stack

Type:string (readonly)
stack

Inherited from @aws-cdk/cdk.StackElement

The stack this Construct has been made a part of

Protected property

Type:@aws-cdk/cdk.Stack

CfnQueuePolicyProps (interface)

class @aws-cdk/aws-sqs.CfnQueuePolicyProps

Language-specific names:

using Amazon.CDK.AWS.SQS;
import software.amazon.awscdk.services.sqs.CfnQueuePolicyProps;
// CfnQueuePolicyProps is an interface
import { CfnQueuePolicyProps } from '@aws-cdk/aws-sqs';
policyDocument

AWS::SQS::QueuePolicy.PolicyDocument

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sqs-policy.html#cfn-sqs-queuepolicy-policydoc

Type:json or @aws-cdk/cdk.Token
queues

AWS::SQS::QueuePolicy.Queues

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sqs-policy.html#cfn-sqs-queuepolicy-queues

Type:@aws-cdk/cdk.Token or (string or @aws-cdk/cdk.Token)[]

CfnQueueProps (interface)

class @aws-cdk/aws-sqs.CfnQueueProps

Language-specific names:

using Amazon.CDK.AWS.SQS;
import software.amazon.awscdk.services.sqs.CfnQueueProps;
// CfnQueueProps is an interface
import { CfnQueueProps } from '@aws-cdk/aws-sqs';
contentBasedDeduplication

AWS::SQS::Queue.ContentBasedDeduplication

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sqs-queues.html#aws-sqs-queue-contentbaseddeduplication

Type:boolean or @aws-cdk/cdk.Token (optional)
delaySeconds

AWS::SQS::Queue.DelaySeconds

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sqs-queues.html#aws-sqs-queue-delayseconds

Type:number or @aws-cdk/cdk.Token (optional)
fifoQueue

AWS::SQS::Queue.FifoQueue

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sqs-queues.html#aws-sqs-queue-fifoqueue

Type:boolean or @aws-cdk/cdk.Token (optional)
kmsDataKeyReusePeriodSeconds

AWS::SQS::Queue.KmsDataKeyReusePeriodSeconds

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sqs-queues.html#aws-sqs-queue-kmsdatakeyreuseperiodseconds

Type:number or @aws-cdk/cdk.Token (optional)
kmsMasterKeyId

AWS::SQS::Queue.KmsMasterKeyId

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sqs-queues.html#aws-sqs-queue-kmsmasterkeyid

Type:string (optional)
maximumMessageSize

AWS::SQS::Queue.MaximumMessageSize

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sqs-queues.html#aws-sqs-queue-maxmesgsize

Type:number or @aws-cdk/cdk.Token (optional)
messageRetentionPeriod

AWS::SQS::Queue.MessageRetentionPeriod

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sqs-queues.html#aws-sqs-queue-msgretentionperiod

Type:number or @aws-cdk/cdk.Token (optional)
queueName

AWS::SQS::Queue.QueueName

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sqs-queues.html#aws-sqs-queue-name

Type:string (optional)
receiveMessageWaitTimeSeconds

AWS::SQS::Queue.ReceiveMessageWaitTimeSeconds

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sqs-queues.html#aws-sqs-queue-receivemsgwaittime

Type:number or @aws-cdk/cdk.Token (optional)
redrivePolicy

AWS::SQS::Queue.RedrivePolicy

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sqs-queues.html#aws-sqs-queue-redrive

Type:json or @aws-cdk/cdk.Token (optional)
tags

AWS::SQS::Queue.Tags

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sqs-queues.html#cfn-sqs-queue-tags

Type:@aws-cdk/cdk.Token or (@aws-cdk/cdk.Token or @aws-cdk/cdk.CfnTag)[] (optional)
visibilityTimeout

AWS::SQS::Queue.VisibilityTimeout

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sqs-queues.html#aws-sqs-queue-visiblitytimeout

Type:number or @aws-cdk/cdk.Token (optional)

DeadLetterQueue (interface)

class @aws-cdk/aws-sqs.DeadLetterQueue

Language-specific names:

using Amazon.CDK.AWS.SQS;
import software.amazon.awscdk.services.sqs.DeadLetterQueue;
// DeadLetterQueue is an interface
import { DeadLetterQueue } from '@aws-cdk/aws-sqs';

Dead letter queue settings

maxReceiveCount

The number of times a message can be unsuccesfully dequeued before being moved to the dead-letter queue.

Type:number
queue

The dead-letter queue to which Amazon SQS moves messages after the value of maxReceiveCount is exceeded.

Type:IQueue

IQueue (interface)

class @aws-cdk/aws-sqs.IQueue

Language-specific names:

using Amazon.CDK.AWS.SQS;
import software.amazon.awscdk.services.sqs.IQueue;
// IQueue is an interface
import { IQueue } from '@aws-cdk/aws-sqs';
Extends:@aws-cdk/cdk.IConstruct
Extends:@aws-cdk/aws-s3-notifications.IBucketNotificationDestination
Extends:@aws-cdk/aws-autoscaling-api.ILifecycleHookTarget
queueArn

The ARN of this queue

Type:string (readonly)
queueName

The name of this queue

Type:string (readonly)
queueUrl

The URL of this queue

Type:string (readonly)
encryptionMasterKey

If this queue is server-side encrypted, this is the KMS encryption key.

Type:@aws-cdk/aws-kms.IEncryptionKey (optional) (readonly)
addToResourcePolicy(statement)

Adds a statement to the IAM resource policy associated with this queue.

If this queue was created in this stack (new Queue), a queue policy

will be automatically created upon the first call to addToPolicy. If

the queue is improted (Queue.import), then this is a no-op.

Parameters:statement (@aws-cdk/aws-iam.PolicyStatement) –
Abstract:Yes
export() → @aws-cdk/aws-sqs.QueueImportProps

Export a queue

Return type:QueueImportProps
Abstract:Yes
grant(identity, *queueActions)

Grant the actions defined in queueActions to the identity Principal given

on this SQS queue resource.

Parameters:
Abstract:

Yes

grantConsumeMessages([identity])

Grant permissions to consume messages from a queue

This will grant the following permissions:

  • sqs:ChangeMessageVisibility
  • sqs:ChangeMessageVisibilityBatch
  • sqs:DeleteMessage
  • sqs:ReceiveMessage
  • sqs:DeleteMessageBatch
  • sqs:GetQueueAttributes
  • sqs:GetQueueUrl
Parameters:identity (@aws-cdk/aws-iam.IPrincipal (optional)) – Principal to grant consume rights to
Abstract:Yes
grantPurge([identity])

Grant an IAM principal permissions to purge all messages from the queue.

This will grant the following permissions:

  • sqs:PurgeQueue
  • sqs:GetQueueAttributes
  • sqs:GetQueueUrl
Parameters:identity (@aws-cdk/aws-iam.IPrincipal (optional)) – Principal to grant send rights to
Abstract:Yes
grantSendMessages([identity])

Grant access to send messages to a queue to the given identity.

This will grant the following permissions:

  • sqs:SendMessage
  • sqs:SendMessageBatch
  • sqs:GetQueueAttributes
  • sqs:GetQueueUrl
Parameters:identity (@aws-cdk/aws-iam.IPrincipal (optional)) – Principal to grant send rights to
Abstract:Yes
metric(metricName[, props]) → @aws-cdk/aws-cloudwatch.Metric

Return the given named metric for this Queue

Parameters:
Return type:

@aws-cdk/aws-cloudwatch.Metric

Abstract:

Yes

metricApproximateAgeOfOldestMessage([props]) → @aws-cdk/aws-cloudwatch.Metric

The approximate age of the oldest non-deleted message in the queue.

Maximum over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
Abstract:Yes
metricApproximateNumberOfMessagesDelayed([props]) → @aws-cdk/aws-cloudwatch.Metric

The number of messages in the queue that are delayed and not available for reading immediately.

Maximum over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
Abstract:Yes
metricApproximateNumberOfMessagesNotVisible([props]) → @aws-cdk/aws-cloudwatch.Metric

The number of messages that are in flight.

Maximum over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
Abstract:Yes
metricApproximateNumberOfMessagesVisible([props]) → @aws-cdk/aws-cloudwatch.Metric

The number of messages available for retrieval from the queue.

Maximum over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
Abstract:Yes
metricNumberOfEmptyReceives([props]) → @aws-cdk/aws-cloudwatch.Metric

The number of ReceiveMessage API calls that did not return a message.

Sum over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
Abstract:Yes
metricNumberOfMessagesDeleted([props]) → @aws-cdk/aws-cloudwatch.Metric

The number of messages deleted from the queue.

Sum over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
Abstract:Yes
metricNumberOfMessagesReceived([props]) → @aws-cdk/aws-cloudwatch.Metric

The number of messages returned by calls to the ReceiveMessage action.

Sum over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
Abstract:Yes
metricNumberOfMessagesSent([props]) → @aws-cdk/aws-cloudwatch.Metric

The number of messages added to a queue.

Sum over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
Abstract:Yes
metricSentMessageSize([props]) → @aws-cdk/aws-cloudwatch.Metric

The size of messages added to a queue.

Average over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
Abstract:Yes
asLifecycleHookTarget(lifecycleHook) → @aws-cdk/aws-autoscaling-api.LifecycleHookTargetProps

Inherited from @aws-cdk/aws-autoscaling-api.ILifecycleHookTarget

Called when this object is used as the target of a lifecycle hook

Parameters:lifecycleHook (@aws-cdk/aws-autoscaling-api.ILifecycleHook) –
Return type:@aws-cdk/aws-autoscaling-api.LifecycleHookTargetProps
Abstract:Yes
asBucketNotificationDestination(bucketArn, bucketId) → @aws-cdk/aws-s3-notifications.BucketNotificationDestinationProps

Inherited from @aws-cdk/aws-s3-notifications.IBucketNotificationDestination

Registers this resource to receive notifications for the specified

bucket. This method will only be called once for each destination/bucket

pair and the result will be cached, so there is no need to implement

idempotency in each destination.

Parameters:
  • bucketArn (string) – The ARN of the bucket
  • bucketId (string) – A unique ID of this bucket in the stack
Return type:

@aws-cdk/aws-s3-notifications.BucketNotificationDestinationProps

Abstract:

Yes

node

Inherited from @aws-cdk/cdk.IConstruct

The construct node in the scope tree.

Type:@aws-cdk/cdk.ConstructNode (readonly)
dependencyRoots

Inherited from @aws-cdk/cdk.IDependable

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)

Queue

class @aws-cdk/aws-sqs.Queue(scope, id[, props])

Language-specific names:

using Amazon.CDK.AWS.SQS;
import software.amazon.awscdk.services.sqs.Queue;
const { Queue } = require('@aws-cdk/aws-sqs');
import { Queue } from '@aws-cdk/aws-sqs';

A new Amazon SQS queue

Extends:

QueueBase

Parameters:
static import(scope, id, props) → @aws-cdk/aws-sqs.IQueue

Import an existing queue

Parameters:
Return type:

IQueue

export() → @aws-cdk/aws-sqs.QueueImportProps

Implements @aws-cdk/aws-sqs.QueueBase.export()

Export a queue

Return type:QueueImportProps
autoCreatePolicy

Implements @aws-cdk/aws-sqs.QueueBase.autoCreatePolicy()

Controls automatic creation of policy objects.

Set by subclasses.

Protected property

Type:boolean (readonly)
queueArn

Implements @aws-cdk/aws-sqs.QueueBase.queueArn()

The ARN of this queue

Type:string (readonly)
queueName

Implements @aws-cdk/aws-sqs.QueueBase.queueName()

The name of this queue

Type:string (readonly)
queueUrl

Implements @aws-cdk/aws-sqs.QueueBase.queueUrl()

The URL of this queue

Type:string (readonly)
encryptionMasterKey

Implements @aws-cdk/aws-sqs.QueueBase.encryptionMasterKey()

If this queue is encrypted, this is the KMS key.

Type:@aws-cdk/aws-kms.IEncryptionKey (optional) (readonly)
addToResourcePolicy(statement)

Inherited from @aws-cdk/aws-sqs.QueueBase

Adds a statement to the IAM resource policy associated with this queue.

If this queue was created in this stack (new Queue), a queue policy

will be automatically created upon the first call to addToPolicy. If

the queue is improted (Queue.import), then this is a no-op.

Parameters:statement (@aws-cdk/aws-iam.PolicyStatement) –
asBucketNotificationDestination(bucketArn, bucketId) → @aws-cdk/aws-s3-notifications.BucketNotificationDestinationProps

Inherited from @aws-cdk/aws-sqs.QueueBase

Allows using SQS queues as destinations for bucket notifications.

Use bucket.onEvent(event, queue) to subscribe.

Parameters:
  • bucketArn (string) – The ARN of the notifying bucket.
  • bucketId (string) – A unique ID for the notifying bucket.
Return type:

@aws-cdk/aws-s3-notifications.BucketNotificationDestinationProps

asLifecycleHookTarget(lifecycleHook) → @aws-cdk/aws-autoscaling-api.LifecycleHookTargetProps

Inherited from @aws-cdk/aws-sqs.QueueBase

Allow using SQS queues as lifecycle hook targets

Parameters:lifecycleHook (@aws-cdk/aws-autoscaling-api.ILifecycleHook) –
Return type:@aws-cdk/aws-autoscaling-api.LifecycleHookTargetProps
grant(identity, *queueActions)

Inherited from @aws-cdk/aws-sqs.QueueBase

Grant the actions defined in queueActions to the identity Principal given

on this SQS queue resource.

Parameters:
grantConsumeMessages([identity])

Inherited from @aws-cdk/aws-sqs.QueueBase

Grant permissions to consume messages from a queue

This will grant the following permissions:

  • sqs:ChangeMessageVisibility
  • sqs:ChangeMessageVisibilityBatch
  • sqs:DeleteMessage
  • sqs:ReceiveMessage
  • sqs:DeleteMessageBatch
  • sqs:GetQueueAttributes
  • sqs:GetQueueUrl
Parameters:identity (@aws-cdk/aws-iam.IPrincipal (optional)) – Principal to grant consume rights to
grantPurge([identity])

Inherited from @aws-cdk/aws-sqs.QueueBase

Grant an IAM principal permissions to purge all messages from the queue.

This will grant the following permissions:

  • sqs:PurgeQueue
  • sqs:GetQueueAttributes
  • sqs:GetQueueUrl
Parameters:identity (@aws-cdk/aws-iam.IPrincipal (optional)) – Principal to grant send rights to
grantSendMessages([identity])

Inherited from @aws-cdk/aws-sqs.QueueBase

Grant access to send messages to a queue to the given identity.

This will grant the following permissions:

  • sqs:SendMessage
  • sqs:SendMessageBatch
  • sqs:GetQueueAttributes
  • sqs:GetQueueUrl
Parameters:identity (@aws-cdk/aws-iam.IPrincipal (optional)) – Principal to grant send rights to
metric(metricName[, props]) → @aws-cdk/aws-cloudwatch.Metric

Inherited from @aws-cdk/aws-sqs.QueueBase

Return the given named metric for this Queue

Parameters:
Return type:

@aws-cdk/aws-cloudwatch.Metric

metricApproximateAgeOfOldestMessage([props]) → @aws-cdk/aws-cloudwatch.Metric

Inherited from @aws-cdk/aws-sqs.QueueBase

The approximate age of the oldest non-deleted message in the queue.

Maximum over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
metricApproximateNumberOfMessagesDelayed([props]) → @aws-cdk/aws-cloudwatch.Metric

Inherited from @aws-cdk/aws-sqs.QueueBase

The number of messages in the queue that are delayed and not available for reading immediately.

Maximum over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
metricApproximateNumberOfMessagesNotVisible([props]) → @aws-cdk/aws-cloudwatch.Metric

Inherited from @aws-cdk/aws-sqs.QueueBase

The number of messages that are in flight.

Maximum over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
metricApproximateNumberOfMessagesVisible([props]) → @aws-cdk/aws-cloudwatch.Metric

Inherited from @aws-cdk/aws-sqs.QueueBase

The number of messages available for retrieval from the queue.

Maximum over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
metricNumberOfEmptyReceives([props]) → @aws-cdk/aws-cloudwatch.Metric

Inherited from @aws-cdk/aws-sqs.QueueBase

The number of ReceiveMessage API calls that did not return a message.

Sum over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
metricNumberOfMessagesDeleted([props]) → @aws-cdk/aws-cloudwatch.Metric

Inherited from @aws-cdk/aws-sqs.QueueBase

The number of messages deleted from the queue.

Sum over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
metricNumberOfMessagesReceived([props]) → @aws-cdk/aws-cloudwatch.Metric

Inherited from @aws-cdk/aws-sqs.QueueBase

The number of messages returned by calls to the ReceiveMessage action.

Sum over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
metricNumberOfMessagesSent([props]) → @aws-cdk/aws-cloudwatch.Metric

Inherited from @aws-cdk/aws-sqs.QueueBase

The number of messages added to a queue.

Sum over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
metricSentMessageSize([props]) → @aws-cdk/aws-cloudwatch.Metric

Inherited from @aws-cdk/aws-sqs.QueueBase

The size of messages added to a queue.

Average over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
apply(aspect)

Inherited from @aws-cdk/cdk.Construct

Applies the aspect to this Constructs node

Parameters:aspect (@aws-cdk/cdk.IAspect) –
prepare()

Inherited from @aws-cdk/cdk.Construct

Perform final modifications before synthesis

This method can be implemented by derived constructs in order to perform

final changes before synthesis. prepare() will be called after child

constructs have been prepared.

This is an advanced framework feature. Only use this if you

understand the implications.

Protected method

toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:@aws-cdk/cdk.ConstructNode (readonly)

QueueBase

class @aws-cdk/aws-sqs.QueueBase(scope, id)

Language-specific names:

using Amazon.CDK.AWS.SQS;
import software.amazon.awscdk.services.sqs.QueueBase;
const { QueueBase } = require('@aws-cdk/aws-sqs');
import { QueueBase } from '@aws-cdk/aws-sqs';

Reference to a new or existing Amazon SQS queue

Extends:

@aws-cdk/cdk.Construct

Implements:

IQueue

Abstract:

Yes

Parameters:
  • scope (@aws-cdk/cdk.Construct) – The scope in which to define this construct
  • id (string) – The scoped construct ID. Must be unique amongst siblings. If the ID includes a path separator (/), then it will be replaced by double dash .
addToResourcePolicy(statement)

Implements @aws-cdk/aws-sqs.IQueue.addToResourcePolicy()

Adds a statement to the IAM resource policy associated with this queue.

If this queue was created in this stack (new Queue), a queue policy

will be automatically created upon the first call to addToPolicy. If

the queue is improted (Queue.import), then this is a no-op.

Parameters:statement (@aws-cdk/aws-iam.PolicyStatement) –
asBucketNotificationDestination(bucketArn, bucketId) → @aws-cdk/aws-s3-notifications.BucketNotificationDestinationProps

Implements @aws-cdk/aws-s3-notifications.IBucketNotificationDestination.asBucketNotificationDestination()

Allows using SQS queues as destinations for bucket notifications.

Use bucket.onEvent(event, queue) to subscribe.

Parameters:
  • bucketArn (string) – The ARN of the notifying bucket.
  • bucketId (string) – A unique ID for the notifying bucket.
Return type:

@aws-cdk/aws-s3-notifications.BucketNotificationDestinationProps

asLifecycleHookTarget(lifecycleHook) → @aws-cdk/aws-autoscaling-api.LifecycleHookTargetProps

Implements @aws-cdk/aws-autoscaling-api.ILifecycleHookTarget.asLifecycleHookTarget()

Allow using SQS queues as lifecycle hook targets

Parameters:lifecycleHook (@aws-cdk/aws-autoscaling-api.ILifecycleHook) –
Return type:@aws-cdk/aws-autoscaling-api.LifecycleHookTargetProps
export() → @aws-cdk/aws-sqs.QueueImportProps

Implements @aws-cdk/aws-sqs.IQueue.export()

Export a queue

Return type:QueueImportProps
Abstract:Yes
grant(identity, *queueActions)

Implements @aws-cdk/aws-sqs.IQueue.grant()

Grant the actions defined in queueActions to the identity Principal given

on this SQS queue resource.

Parameters:
grantConsumeMessages([identity])

Implements @aws-cdk/aws-sqs.IQueue.grantConsumeMessages()

Grant permissions to consume messages from a queue

This will grant the following permissions:

  • sqs:ChangeMessageVisibility
  • sqs:ChangeMessageVisibilityBatch
  • sqs:DeleteMessage
  • sqs:ReceiveMessage
  • sqs:DeleteMessageBatch
  • sqs:GetQueueAttributes
  • sqs:GetQueueUrl
Parameters:identity (@aws-cdk/aws-iam.IPrincipal (optional)) – Principal to grant consume rights to
grantPurge([identity])

Implements @aws-cdk/aws-sqs.IQueue.grantPurge()

Grant an IAM principal permissions to purge all messages from the queue.

This will grant the following permissions:

  • sqs:PurgeQueue
  • sqs:GetQueueAttributes
  • sqs:GetQueueUrl
Parameters:identity (@aws-cdk/aws-iam.IPrincipal (optional)) – Principal to grant send rights to
grantSendMessages([identity])

Implements @aws-cdk/aws-sqs.IQueue.grantSendMessages()

Grant access to send messages to a queue to the given identity.

This will grant the following permissions:

  • sqs:SendMessage
  • sqs:SendMessageBatch
  • sqs:GetQueueAttributes
  • sqs:GetQueueUrl
Parameters:identity (@aws-cdk/aws-iam.IPrincipal (optional)) – Principal to grant send rights to
metric(metricName[, props]) → @aws-cdk/aws-cloudwatch.Metric

Implements @aws-cdk/aws-sqs.IQueue.metric()

Return the given named metric for this Queue

Parameters:
Return type:

@aws-cdk/aws-cloudwatch.Metric

metricApproximateAgeOfOldestMessage([props]) → @aws-cdk/aws-cloudwatch.Metric

Implements @aws-cdk/aws-sqs.IQueue.metricApproximateAgeOfOldestMessage()

The approximate age of the oldest non-deleted message in the queue.

Maximum over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
metricApproximateNumberOfMessagesDelayed([props]) → @aws-cdk/aws-cloudwatch.Metric

Implements @aws-cdk/aws-sqs.IQueue.metricApproximateNumberOfMessagesDelayed()

The number of messages in the queue that are delayed and not available for reading immediately.

Maximum over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
metricApproximateNumberOfMessagesNotVisible([props]) → @aws-cdk/aws-cloudwatch.Metric

Implements @aws-cdk/aws-sqs.IQueue.metricApproximateNumberOfMessagesNotVisible()

The number of messages that are in flight.

Maximum over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
metricApproximateNumberOfMessagesVisible([props]) → @aws-cdk/aws-cloudwatch.Metric

Implements @aws-cdk/aws-sqs.IQueue.metricApproximateNumberOfMessagesVisible()

The number of messages available for retrieval from the queue.

Maximum over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
metricNumberOfEmptyReceives([props]) → @aws-cdk/aws-cloudwatch.Metric

Implements @aws-cdk/aws-sqs.IQueue.metricNumberOfEmptyReceives()

The number of ReceiveMessage API calls that did not return a message.

Sum over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
metricNumberOfMessagesDeleted([props]) → @aws-cdk/aws-cloudwatch.Metric

Implements @aws-cdk/aws-sqs.IQueue.metricNumberOfMessagesDeleted()

The number of messages deleted from the queue.

Sum over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
metricNumberOfMessagesReceived([props]) → @aws-cdk/aws-cloudwatch.Metric

Implements @aws-cdk/aws-sqs.IQueue.metricNumberOfMessagesReceived()

The number of messages returned by calls to the ReceiveMessage action.

Sum over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
metricNumberOfMessagesSent([props]) → @aws-cdk/aws-cloudwatch.Metric

Implements @aws-cdk/aws-sqs.IQueue.metricNumberOfMessagesSent()

The number of messages added to a queue.

Sum over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
metricSentMessageSize([props]) → @aws-cdk/aws-cloudwatch.Metric

Implements @aws-cdk/aws-sqs.IQueue.metricSentMessageSize()

The size of messages added to a queue.

Average over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
autoCreatePolicy

Controls automatic creation of policy objects.

Set by subclasses.

Protected property

Type:boolean (readonly) (abstract)
queueArn

Implements @aws-cdk/aws-sqs.IQueue.queueArn()

The ARN of this queue

Type:string (readonly) (abstract)
queueName

Implements @aws-cdk/aws-sqs.IQueue.queueName()

The name of this queue

Type:string (readonly) (abstract)
queueUrl

Implements @aws-cdk/aws-sqs.IQueue.queueUrl()

The URL of this queue

Type:string (readonly) (abstract)
encryptionMasterKey

Implements @aws-cdk/aws-sqs.IQueue.encryptionMasterKey()

If this queue is server-side encrypted, this is the KMS encryption key.

Type:@aws-cdk/aws-kms.IEncryptionKey (optional) (readonly) (abstract)
apply(aspect)

Inherited from @aws-cdk/cdk.Construct

Applies the aspect to this Constructs node

Parameters:aspect (@aws-cdk/cdk.IAspect) –
prepare()

Inherited from @aws-cdk/cdk.Construct

Perform final modifications before synthesis

This method can be implemented by derived constructs in order to perform

final changes before synthesis. prepare() will be called after child

constructs have been prepared.

This is an advanced framework feature. Only use this if you

understand the implications.

Protected method

toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:@aws-cdk/cdk.ConstructNode (readonly)

QueueEncryption (enum)

class @aws-cdk/aws-sqs.QueueEncryption

Language-specific names:

using Amazon.CDK.AWS.SQS;
import software.amazon.awscdk.services.sqs.QueueEncryption;
const { QueueEncryption } = require('@aws-cdk/aws-sqs');
import { QueueEncryption } from '@aws-cdk/aws-sqs';

What kind of encryption to apply to this queue

Unencrypted

Messages in the queue are not encrypted

KmsManaged

Server-side KMS encryption with a master key managed by SQS.

Kms

Server-side encryption with a KMS key managed by the user.

If encryptionKey is specified, this key will be used, otherwise, one will be defined.

QueueImportProps (interface)

class @aws-cdk/aws-sqs.QueueImportProps

Language-specific names:

using Amazon.CDK.AWS.SQS;
import software.amazon.awscdk.services.sqs.QueueImportProps;
// QueueImportProps is an interface
import { QueueImportProps } from '@aws-cdk/aws-sqs';

Reference to a queue

queueArn

The ARN of the queue.

Type:string
queueUrl

The URL of the queue.

Type:string
keyArn

KMS encryption key, if this queue is server-side encrypted by a KMS key.

Type:string (optional)
queueName

The name of the queue.

Type:string (optional)
Default:if queue name is not specified, the name will be derived from the queue ARN

QueuePolicy

class @aws-cdk/aws-sqs.QueuePolicy(scope, id, props)

Language-specific names:

using Amazon.CDK.AWS.SQS;
import software.amazon.awscdk.services.sqs.QueuePolicy;
const { QueuePolicy } = require('@aws-cdk/aws-sqs');
import { QueuePolicy } from '@aws-cdk/aws-sqs';

Applies a policy to SQS queues.

Extends:

@aws-cdk/cdk.Construct

Parameters:
document

The IAM policy document for this policy.

Type:@aws-cdk/aws-iam.PolicyDocument (readonly)
apply(aspect)

Inherited from @aws-cdk/cdk.Construct

Applies the aspect to this Constructs node

Parameters:aspect (@aws-cdk/cdk.IAspect) –
prepare()

Inherited from @aws-cdk/cdk.Construct

Perform final modifications before synthesis

This method can be implemented by derived constructs in order to perform

final changes before synthesis. prepare() will be called after child

constructs have been prepared.

This is an advanced framework feature. Only use this if you

understand the implications.

Protected method

toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:@aws-cdk/cdk.ConstructNode (readonly)

QueuePolicyProps (interface)

class @aws-cdk/aws-sqs.QueuePolicyProps

Language-specific names:

using Amazon.CDK.AWS.SQS;
import software.amazon.awscdk.services.sqs.QueuePolicyProps;
// QueuePolicyProps is an interface
import { QueuePolicyProps } from '@aws-cdk/aws-sqs';
queues

The set of queues this policy applies to.

Type:IQueue[]

QueueProps (interface)

class @aws-cdk/aws-sqs.QueueProps

Language-specific names:

using Amazon.CDK.AWS.SQS;
import software.amazon.awscdk.services.sqs.QueueProps;
// QueueProps is an interface
import { QueueProps } from '@aws-cdk/aws-sqs';

Properties for creating a new Queue

contentBasedDeduplication

Specifies whether to enable content-based deduplication.

During the deduplication interval (5 minutes), Amazon SQS treats

messages that are sent with identical content (excluding attributes) as

duplicates and delivers only one copy of the message.

If you don’t enable content-based deduplication and you want to deduplicate

messages, provide an explicit deduplication ID in your SendMessage() call.

(Only applies to FIFO queues.)

Type:boolean (optional)
Default:false
dataKeyReuseSec

The length of time that Amazon SQS reuses a data key before calling KMS again.

The value must be an integer between 60 (1 minute) and 86,400 (24

hours). The default is 300 (5 minutes).

Type:number (optional)
Default:300 (5 minutes)
deadLetterQueue

Send messages to this queue if they were unsuccessfully dequeued a number of times.

Type:DeadLetterQueue (optional)
Default:no dead-letter queue
deliveryDelaySec

The time in seconds that the delivery of all messages in the queue is delayed.

You can specify an integer value of 0 to 900 (15 minutes). The default

value is 0.

Type:number (optional)
Default:0
encryption

Whether the contents of the queue are encrypted, and by what type of key.

Be aware that encryption is not available in all regions, please see the docs

for current availability details.

Type:QueueEncryption (optional)
Default:Unencrypted
encryptionMasterKey

External KMS master key to use for queue encryption.

Individual messages will be encrypted using data keys. The data keys in

turn will be encrypted using this key, and reused for a maximum of

dataKeyReuseSecs seconds.

The ‘encryption’ property must be either not specified or set to “Kms”.

An error will be emitted if encryption is set to “Unencrypted” or

“KmsManaged”.

Type:@aws-cdk/aws-kms.IEncryptionKey (optional)
Default:If encryption is set to KMS and not specified, a key will be created.
fifo

Whether this a first-in-first-out (FIFO) queue.

Type:boolean (optional)
Default:false, unless queueName ends in ‘.fifo’ or ‘contentBasedDeduplication’ is true.
maxMessageSizeBytes

The limit of how many bytes that a message can contain before Amazon SQS rejects it.

You can specify an integer value from 1024 bytes (1 KiB) to 262144 bytes

(256 KiB). The default value is 262144 (256 KiB).

Type:number (optional)
Default:256KiB
queueName

A name for the queue.

If specified and this is a FIFO queue, must end in the string ‘.fifo’.

Type:string (optional)
Default:CloudFormation-generated name
receiveMessageWaitTimeSec

Default wait time for ReceiveMessage calls.

Does not wait if set to 0, otherwise waits this amount of seconds

by default for messages to arrive.

For more information, see Amazon SQS Long Poll.

Type:number (optional)
Default:0
retentionPeriodSec

The number of seconds that Amazon SQS retains a message.

You can specify an integer value from 60 seconds (1 minute) to 1209600

seconds (14 days). The default value is 345600 seconds (4 days).

Type:number (optional)
Default:345600 seconds (4 days)
visibilityTimeoutSec

Timeout of processing a single message.

After dequeuing, the processor has this much time to handle the message

and delete it from the queue before it becomes visible again for dequeueing

by another processor.

Values must be from 0 to 43200 seconds (12 hours). If you don’t specify

a value, AWS CloudFormation uses the default value of 30 seconds.

Type:number (optional)
Default:30