Module sqs
@pulumi/aws > sqs
Index ▹
class Queue
extends CustomResource
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const terraformQueue = new aws.sqs.Queue("terraform_queue", {
delaySeconds: 90,
maxMessageSize: 2048,
messageRetentionSeconds: 86400,
receiveWaitTimeSeconds: 10,
redrivePolicy: aws_sqs_queue_terraform_queue_deadletter.arn.apply(arn => `{"deadLetterTargetArn":"${arn}","maxReceiveCount":4}`),
tags: {
Environment: "production",
},
});
FIFO queue
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const terraformQueue = new aws.sqs.Queue("terraform_queue", {
contentBasedDeduplication: true,
fifoQueue: true,
});
Server-side encryption (SSE)
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const terraformQueue = new aws.sqs.Queue("terraform_queue", {
kmsDataKeyReusePeriodSeconds: 300,
kmsMasterKeyId: "alias/aws/sqs",
});
constructor
new Queue(name: string, args?: QueueArgs, opts?: pulumi.CustomResourceOptions)
Create a Queue resource with the given unique name, arguments, and options.
name
The unique name of the resource.args
The arguments to use to populate this resource's properties.opts
A bag of options that control this resource's behavior.
method get
public static get(name: string, id: pulumi.Input<pulumi.ID>, state?: QueueState, opts?: pulumi.CustomResourceOptions): Queue
Get an existing Queue resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
method getProvider
method isInstance
static isInstance(obj: any): boolean
Returns true if the given object is an instance of CustomResource. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.
method onEvent
onEvent(name: string, handler: QueueEventHandler, args?: QueueEventSubscriptionArgs, opts?: pulumi.ComponentResourceOptions): QueueEventSubscription
Creates a new subscription to events fired from this Queue to the handler provided, along with options to control the behavior of the subscription.
property arn
public arn: pulumi.Output<string>;
The ARN of the SQS queue
property contentBasedDeduplication
public contentBasedDeduplication: pulumi.Output<boolean | undefined>;
Enables content-based deduplication for FIFO queues. For more information, see the related documentation
property delaySeconds
public delaySeconds: pulumi.Output<number | undefined>;
The time in seconds that the delivery of all messages in the queue will be delayed. An integer from 0 to 900 (15 minutes). The default for this attribute is 0 seconds.
property fifoQueue
public fifoQueue: pulumi.Output<boolean | undefined>;
Boolean designating a FIFO queue. If not set, it defaults to false
making it standard.
property id
id: Output<ID>;
id is the provider-assigned unique ID for this managed resource. It is set during deployments and may be missing (undefined) during planning phases.
property kmsDataKeyReusePeriodSeconds
public kmsDataKeyReusePeriodSeconds: pulumi.Output<number>;
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).
property kmsMasterKeyId
public kmsMasterKeyId: pulumi.Output<string | undefined>;
The ID of an AWS-managed customer master key (CMK) for Amazon SQS or a custom CMK. For more information, see Key Terms.
property maxMessageSize
public maxMessageSize: pulumi.Output<number | undefined>;
The limit of how many bytes a message can contain before Amazon SQS rejects it. An integer from 1024 bytes (1 KiB) up to 262144 bytes (256 KiB). The default for this attribute is 262144 (256 KiB).
property messageRetentionSeconds
public messageRetentionSeconds: pulumi.Output<number | undefined>;
The number of seconds Amazon SQS retains a message. Integer representing seconds, from 60 (1 minute) to 1209600 (14 days). The default for this attribute is 345600 (4 days).
property name
public name: pulumi.Output<string>;
This is the human-readable name of the queue. If omitted, Terraform will assign a random name.
property namePrefix
public namePrefix: pulumi.Output<string | undefined>;
Creates a unique name beginning with the specified prefix. Conflicts with name
.
property policy
public policy: pulumi.Output<string>;
The JSON policy for the SQS queue. For more information about building AWS IAM policy documents with Terraform, see the AWS IAM Policy Document Guide.
property receiveWaitTimeSeconds
public receiveWaitTimeSeconds: pulumi.Output<number | undefined>;
The time for which a ReceiveMessage call will wait for a message to arrive (long polling) before returning. An integer from 0 to 20 (seconds). The default for this attribute is 0, meaning that the call will return immediately.
property redrivePolicy
public redrivePolicy: pulumi.Output<string | undefined>;
The JSON policy to set up the Dead Letter Queue, see AWS docs. Note: when specifying maxReceiveCount
, you must specify it as an integer (5
), and not a string ("5"
).
property tags
public tags: pulumi.Output<{[key: string]: any} | undefined>;
A mapping of tags to assign to the queue.
property urn
urn: Output<URN>;
urn is the stable logical URN used to distinctly address a resource, both before and after deployments.
property visibilityTimeoutSeconds
public visibilityTimeoutSeconds: pulumi.Output<number | undefined>;
The visibility timeout for the queue. An integer from 0 to 43200 (12 hours). The default for this attribute is 30. For more information about visibility timeout, see AWS docs.
class QueueEventSubscription
extends EventSubscription
constructor
public new QueueEventSubscription(name: string, queue: queue.Queue, handler: QueueEventHandler, args: QueueEventSubscriptionArgs, opts?: pulumi.ComponentResourceOptions)
method getProvider
method isInstance
method registerOutputs
property eventSourceMapping
public eventSourceMapping: lambda.EventSourceMapping;
The underlying sns object created for the subscription.
property func
public func: LambdaFunction;
property permission
public permission: permission.Permission;
property queue
public queue: queue.Queue;
property urn
class QueuePolicy
extends CustomResource
Allows you to set a policy of an SQS Queue while referencing ARN of the queue within the policy.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const queue = new aws.sqs.Queue("q", {});
const test = new aws.sqs.QueuePolicy("test", {
policy: pulumi.all([queue.arn, queue.arn]).apply(([queueArn, queueArn1]) => `{
"Version": "2012-10-17",
"Id": "sqspolicy",
"Statement": [
{
"Sid": "First",
"Effect": "Allow",
"Principal": "*",
"Action": "sqs:SendMessage",
"Resource": "${queueArn}",
"Condition": {
"ArnEquals": {
"aws:SourceArn": "${queueArn1}"
}
}
}
]
}
`),
queueUrl: queue.id,
});
constructor
new QueuePolicy(name: string, args: QueuePolicyArgs, opts?: pulumi.CustomResourceOptions)
Create a QueuePolicy resource with the given unique name, arguments, and options.
name
The unique name of the resource.args
The arguments to use to populate this resource's properties.opts
A bag of options that control this resource's behavior.
method get
public static get(name: string, id: pulumi.Input<pulumi.ID>, state?: QueuePolicyState, opts?: pulumi.CustomResourceOptions): QueuePolicy
Get an existing QueuePolicy resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
method getProvider
method isInstance
static isInstance(obj: any): boolean
Returns true if the given object is an instance of CustomResource. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.
property id
id: Output<ID>;
id is the provider-assigned unique ID for this managed resource. It is set during deployments and may be missing (undefined) during planning phases.
property policy
public policy: pulumi.Output<string>;
The JSON policy for the SQS queue. For more information about building AWS IAM policy documents with Terraform, see the AWS IAM Policy Document Guide.
property queueUrl
public queueUrl: pulumi.Output<string>;
The URL of the SQS Queue to which to attach the policy
property urn
function getQueue
getQueue(args: GetQueueArgs, opts?: pulumi.InvokeOptions): Promise<GetQueueResult>
Use this data source to get the ARN and URL of queue in AWS Simple Queue Service (SQS). By using this data source, you can reference SQS queues without having to hardcode the ARNs as input.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = pulumi.output(aws.sqs.getQueue({
name: "queue",
}));
interface GetQueueArgs
A collection of arguments for invoking getQueue.
property name
name: string;
The name of the queue to match.
interface GetQueueResult
A collection of values returned by getQueue.
property arn
arn: string;
The Amazon Resource Name (ARN) of the queue.
property id
id: string;
id is the provider-assigned unique ID for this managed resource.
property url
url: string;
The URL of the queue.
interface QueueArgs
The set of arguments for constructing a Queue resource.
property contentBasedDeduplication
contentBasedDeduplication?: pulumi.Input<boolean>;
Enables content-based deduplication for FIFO queues. For more information, see the related documentation
property delaySeconds
delaySeconds?: pulumi.Input<number>;
The time in seconds that the delivery of all messages in the queue will be delayed. An integer from 0 to 900 (15 minutes). The default for this attribute is 0 seconds.
property fifoQueue
fifoQueue?: pulumi.Input<boolean>;
Boolean designating a FIFO queue. If not set, it defaults to false
making it standard.
property kmsDataKeyReusePeriodSeconds
kmsDataKeyReusePeriodSeconds?: pulumi.Input<number>;
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).
property kmsMasterKeyId
kmsMasterKeyId?: pulumi.Input<string>;
The ID of an AWS-managed customer master key (CMK) for Amazon SQS or a custom CMK. For more information, see Key Terms.
property maxMessageSize
maxMessageSize?: pulumi.Input<number>;
The limit of how many bytes a message can contain before Amazon SQS rejects it. An integer from 1024 bytes (1 KiB) up to 262144 bytes (256 KiB). The default for this attribute is 262144 (256 KiB).
property messageRetentionSeconds
messageRetentionSeconds?: pulumi.Input<number>;
The number of seconds Amazon SQS retains a message. Integer representing seconds, from 60 (1 minute) to 1209600 (14 days). The default for this attribute is 345600 (4 days).
property name
name?: pulumi.Input<string>;
This is the human-readable name of the queue. If omitted, Terraform will assign a random name.
property namePrefix
namePrefix?: pulumi.Input<string>;
Creates a unique name beginning with the specified prefix. Conflicts with name
.
property policy
policy?: pulumi.Input<string>;
The JSON policy for the SQS queue. For more information about building AWS IAM policy documents with Terraform, see the AWS IAM Policy Document Guide.
property receiveWaitTimeSeconds
receiveWaitTimeSeconds?: pulumi.Input<number>;
The time for which a ReceiveMessage call will wait for a message to arrive (long polling) before returning. An integer from 0 to 20 (seconds). The default for this attribute is 0, meaning that the call will return immediately.
property redrivePolicy
redrivePolicy?: pulumi.Input<string>;
The JSON policy to set up the Dead Letter Queue, see AWS docs. Note: when specifying maxReceiveCount
, you must specify it as an integer (5
), and not a string ("5"
).
property tags
tags?: pulumi.Input<{[key: string]: any}>;
A mapping of tags to assign to the queue.
property visibilityTimeoutSeconds
visibilityTimeoutSeconds?: pulumi.Input<number>;
The visibility timeout for the queue. An integer from 0 to 43200 (12 hours). The default for this attribute is 30. For more information about visibility timeout, see AWS docs.
interface QueueEvent
property Records
Records: QueueRecord[];
interface QueuePolicyArgs
The set of arguments for constructing a QueuePolicy resource.
property policy
policy: pulumi.Input<string>;
The JSON policy for the SQS queue. For more information about building AWS IAM policy documents with Terraform, see the AWS IAM Policy Document Guide.
property queueUrl
queueUrl: pulumi.Input<string>;
The URL of the SQS Queue to which to attach the policy
interface QueuePolicyState
Input properties used for looking up and filtering QueuePolicy resources.
property policy
policy?: pulumi.Input<string>;
The JSON policy for the SQS queue. For more information about building AWS IAM policy documents with Terraform, see the AWS IAM Policy Document Guide.
property queueUrl
queueUrl?: pulumi.Input<string>;
The URL of the SQS Queue to which to attach the policy
interface QueueRecord
property attributes
attributes: { ApproximateFirstReceiveTimestamp: string; ApproximateReceiveCount: string; SenderId: string; SentTimestamp: string; };
property awsRegion
awsRegion: string;
property body
body: string;
property eventSource
eventSource: string;
property eventSourceARN
eventSourceARN: string;
property md5OfBody
md5OfBody: string;
property messageAttributes
property messageId
messageId: string;
property receiptHandle
receiptHandle: string;
interface QueueState
Input properties used for looking up and filtering Queue resources.
property arn
arn?: pulumi.Input<string>;
The ARN of the SQS queue
property contentBasedDeduplication
contentBasedDeduplication?: pulumi.Input<boolean>;
Enables content-based deduplication for FIFO queues. For more information, see the related documentation
property delaySeconds
delaySeconds?: pulumi.Input<number>;
The time in seconds that the delivery of all messages in the queue will be delayed. An integer from 0 to 900 (15 minutes). The default for this attribute is 0 seconds.
property fifoQueue
fifoQueue?: pulumi.Input<boolean>;
Boolean designating a FIFO queue. If not set, it defaults to false
making it standard.
property kmsDataKeyReusePeriodSeconds
kmsDataKeyReusePeriodSeconds?: pulumi.Input<number>;
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).
property kmsMasterKeyId
kmsMasterKeyId?: pulumi.Input<string>;
The ID of an AWS-managed customer master key (CMK) for Amazon SQS or a custom CMK. For more information, see Key Terms.
property maxMessageSize
maxMessageSize?: pulumi.Input<number>;
The limit of how many bytes a message can contain before Amazon SQS rejects it. An integer from 1024 bytes (1 KiB) up to 262144 bytes (256 KiB). The default for this attribute is 262144 (256 KiB).
property messageRetentionSeconds
messageRetentionSeconds?: pulumi.Input<number>;
The number of seconds Amazon SQS retains a message. Integer representing seconds, from 60 (1 minute) to 1209600 (14 days). The default for this attribute is 345600 (4 days).
property name
name?: pulumi.Input<string>;
This is the human-readable name of the queue. If omitted, Terraform will assign a random name.
property namePrefix
namePrefix?: pulumi.Input<string>;
Creates a unique name beginning with the specified prefix. Conflicts with name
.
property policy
policy?: pulumi.Input<string>;
The JSON policy for the SQS queue. For more information about building AWS IAM policy documents with Terraform, see the AWS IAM Policy Document Guide.
property receiveWaitTimeSeconds
receiveWaitTimeSeconds?: pulumi.Input<number>;
The time for which a ReceiveMessage call will wait for a message to arrive (long polling) before returning. An integer from 0 to 20 (seconds). The default for this attribute is 0, meaning that the call will return immediately.
property redrivePolicy
redrivePolicy?: pulumi.Input<string>;
The JSON policy to set up the Dead Letter Queue, see AWS docs. Note: when specifying maxReceiveCount
, you must specify it as an integer (5
), and not a string ("5"
).
property tags
tags?: pulumi.Input<{[key: string]: any}>;
A mapping of tags to assign to the queue.
property visibilityTimeoutSeconds
visibilityTimeoutSeconds?: pulumi.Input<number>;
The visibility timeout for the queue. An integer from 0 to 43200 (12 hours). The default for this attribute is 30. For more information about visibility timeout, see AWS docs.
interface RedrivePolicy
The string that includes the parameters for the dead-letter queue functionality of the source queue. For more information about the redrive policy and dead-letter queues, see Using Amazon SQS Dead-Letter Queues in the Amazon Simple Queue Service Developer Guide: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-dead-letter-queues.html.
property deadLetterTargetArn
deadLetterTargetArn: ARN;
The Amazon Resource Name (ARN) of the dead-letter queue to which Amazon SQS moves messages after the value of
maxReceiveCount
is exceeded.
property maxReceiveCount
maxReceiveCount: number;
The number of times a message is delivered to the source queue before being moved to the dead-letter queue.
Note: The dead-letter queue of a FIFO queue must also be a FIFO queue. Similarly, the dead-letter queue of a standard queue must also be a standard queue.
type QueueEventHandler
type QueueEventHandler = lambda.EventHandler<QueueEvent, void>;
type QueueEventSubscriptionArgs
type QueueEventSubscriptionArgs = { batchSize: number; };
Arguments to control the sqs subscription.