@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
417 lines (416 loc) • 23.5 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
/**
* Amazon SQS (Simple Queue Service) is a fully managed message queuing service that enables decoupling and scaling of microservices, distributed systems, and serverless applications. This resource allows you to create, configure, and manage an SQS queue, which acts as a reliable message buffer between producers and consumers. With support for standard and FIFO queues, SQS ensures secure, scalable, and asynchronous message processing. Use this resource to define queue attributes, configure access policies, and integrate seamlessly with AWS services like Lambda, SNS, and EC2.
*
* !> AWS will hang indefinitely, leading to a `timeout while waiting` error, when creating or updating an `aws.sqs.Queue` with an associated `aws.sqs.QueuePolicy` if `Version = "2012-10-17"` is not explicitly set in the policy.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const queue = new aws.sqs.Queue("queue", {
* name: "example-queue",
* delaySeconds: 90,
* maxMessageSize: 2048,
* messageRetentionSeconds: 86400,
* receiveWaitTimeSeconds: 10,
* redrivePolicy: JSON.stringify({
* deadLetterTargetArn: queueDeadletter.arn,
* maxReceiveCount: 4,
* }),
* tags: {
* Environment: "production",
* },
* });
* ```
*
* ## FIFO queue
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const queue = new aws.sqs.Queue("queue", {
* name: "example-queue.fifo",
* fifoQueue: true,
* contentBasedDeduplication: true,
* });
* ```
*
* ## High-throughput FIFO queue
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const queue = new aws.sqs.Queue("queue", {
* name: "pulumi-example-queue.fifo",
* fifoQueue: true,
* deduplicationScope: "messageGroup",
* fifoThroughputLimit: "perMessageGroupId",
* });
* ```
*
* ## Dead-letter queue
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const queue = new aws.sqs.Queue("queue", {
* name: "pulumi-example-queue",
* redrivePolicy: JSON.stringify({
* deadLetterTargetArn: queueDeadletter.arn,
* maxReceiveCount: 4,
* }),
* });
* const exampleQueueDeadletter = new aws.sqs.Queue("example_queue_deadletter", {name: "pulumi-example-deadletter-queue"});
* const exampleQueueRedriveAllowPolicy = new aws.sqs.RedriveAllowPolicy("example_queue_redrive_allow_policy", {
* queueUrl: exampleQueueDeadletter.id,
* redriveAllowPolicy: JSON.stringify({
* redrivePermission: "byQueue",
* sourceQueueArns: [exampleQueue.arn],
* }),
* });
* ```
*
* ## Server-side encryption (SSE)
*
* Using [SSE-SQS](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-configure-sqs-sse-queue.html):
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const queue = new aws.sqs.Queue("queue", {
* name: "pulumi-example-queue",
* sqsManagedSseEnabled: true,
* });
* ```
*
* Using [SSE-KMS](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-configure-sse-existing-queue.html):
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const queue = new aws.sqs.Queue("queue", {
* name: "example-queue",
* kmsMasterKeyId: "alias/aws/sqs",
* kmsDataKeyReusePeriodSeconds: 300,
* });
* ```
*
* ## Import
*
* ### Identity Schema
*
* #### Required
*
* * `url` (String) URL of the SQS queue.
*
* Using `pulumi import`, import SQS Queues using the queue `url`. For example:
*
* console
*
* % pulumi import aws_sqs_queue.example https://queue.amazonaws.com/80398EXAMPLE/MyQueue
*/
export declare class Queue extends pulumi.CustomResource {
/**
* Get an existing Queue resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name: string, id: pulumi.Input<pulumi.ID>, state?: QueueState, opts?: pulumi.CustomResourceOptions): Queue;
/**
* Returns true if the given object is an instance of Queue. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj: any): obj is Queue;
/**
* ARN of the SQS queue.
*/
readonly arn: pulumi.Output<string>;
/**
* Enables content-based deduplication for FIFO queues. For more information, see the [related documentation](http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues.html#FIFO-queues-exactly-once-processing).
*/
readonly contentBasedDeduplication: pulumi.Output<boolean | undefined>;
/**
* Specifies whether message deduplication occurs at the message group or queue level. Valid values are `messageGroup` and `queue` (default).
*/
readonly deduplicationScope: pulumi.Output<string>;
/**
* 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.
*/
readonly delaySeconds: pulumi.Output<number | undefined>;
/**
* Boolean designating a FIFO queue. If not set, it defaults to `false` making it standard.
*/
readonly fifoQueue: pulumi.Output<boolean | undefined>;
/**
* Specifies whether the FIFO queue throughput quota applies to the entire queue or per message group. Valid values are `perQueue` (default) and `perMessageGroupId`.
*/
readonly fifoThroughputLimit: pulumi.Output<string>;
/**
* 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).
*/
readonly kmsDataKeyReusePeriodSeconds: pulumi.Output<number>;
/**
* ID of an AWS-managed customer master key (CMK) for Amazon SQS or a custom CMK. For more information, see [Key Terms](http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-server-side-encryption.html#sqs-sse-key-terms).
*/
readonly kmsMasterKeyId: pulumi.Output<string | undefined>;
/**
* Limit of how many bytes a message can contain before Amazon SQS rejects it. An integer from 1024 bytes (1 KiB) up to 1048576 bytes (1024 KiB). The default for this attribute is 262144 (256 KiB).
*/
readonly maxMessageSize: pulumi.Output<number | undefined>;
/**
* 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).
*/
readonly messageRetentionSeconds: pulumi.Output<number | undefined>;
/**
* Name of the queue. Queue names must be made up of only uppercase and lowercase ASCII letters, numbers, underscores, and hyphens, and must be between 1 and 80 characters long. For a FIFO (first-in-first-out) queue, the name must end with the `.fifo` suffix. If omitted, the provider will assign a random, unique name. Conflicts with `namePrefix`.
*/
readonly name: pulumi.Output<string>;
/**
* Creates a unique name beginning with the specified prefix. Conflicts with `name`.
*/
readonly namePrefix: pulumi.Output<string>;
/**
* JSON policy for the SQS queue. For more information about building AWS IAM policy documents see the AWS IAM Policy Document Guide. The provider will only perform drift detection of its value when present in a configuration. It is preferred to use the `aws.sqs.QueuePolicy` resource instead.
*/
readonly policy: pulumi.Output<string>;
/**
* 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.
*/
readonly receiveWaitTimeSeconds: pulumi.Output<number | undefined>;
/**
* JSON policy to set up the Dead Letter Queue redrive permission, see [AWS docs](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/SQSDeadLetterQueue.html). The provider will only perform drift detection of its value when present in a configuration. It is preferred to use the `aws.sqs.RedriveAllowPolicy` resource instead.
*/
readonly redriveAllowPolicy: pulumi.Output<string>;
/**
* JSON policy to set up the Dead Letter Queue, see [AWS docs](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/SQSDeadLetterQueue.html). The provider will only perform drift detection of its value when present in a configuration. It is preferred to use the `aws.sqs.RedrivePolicy` resource instead. **Note:** when specifying `maxReceiveCount`, you must specify it as an integer (`5`), and not a string (`"5"`).
*/
readonly redrivePolicy: pulumi.Output<string>;
/**
* Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration.
*/
readonly region: pulumi.Output<string>;
/**
* Boolean to enable server-side encryption (SSE) of message content with SQS-owned encryption keys. See [Encryption at rest](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-server-side-encryption.html). The provider will only perform drift detection of its value when present in a configuration.
*/
readonly sqsManagedSseEnabled: pulumi.Output<boolean>;
/**
* Map of tags to assign to the queue. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
*/
readonly tags: pulumi.Output<{
[key: string]: string;
} | undefined>;
/**
* Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
*/
readonly tagsAll: pulumi.Output<{
[key: string]: string;
}>;
/**
* Same as `id`: The URL for the created Amazon SQS queue.
*/
readonly url: pulumi.Output<string>;
/**
* 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](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/AboutVT.html).
*/
readonly visibilityTimeoutSeconds: pulumi.Output<number | undefined>;
/**
* Create a Queue resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args?: QueueArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering Queue resources.
*/
export interface QueueState {
/**
* ARN of the SQS queue.
*/
arn?: pulumi.Input<string>;
/**
* Enables content-based deduplication for FIFO queues. For more information, see the [related documentation](http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues.html#FIFO-queues-exactly-once-processing).
*/
contentBasedDeduplication?: pulumi.Input<boolean>;
/**
* Specifies whether message deduplication occurs at the message group or queue level. Valid values are `messageGroup` and `queue` (default).
*/
deduplicationScope?: pulumi.Input<string>;
/**
* 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.
*/
delaySeconds?: pulumi.Input<number>;
/**
* Boolean designating a FIFO queue. If not set, it defaults to `false` making it standard.
*/
fifoQueue?: pulumi.Input<boolean>;
/**
* Specifies whether the FIFO queue throughput quota applies to the entire queue or per message group. Valid values are `perQueue` (default) and `perMessageGroupId`.
*/
fifoThroughputLimit?: pulumi.Input<string>;
/**
* 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).
*/
kmsDataKeyReusePeriodSeconds?: pulumi.Input<number>;
/**
* ID of an AWS-managed customer master key (CMK) for Amazon SQS or a custom CMK. For more information, see [Key Terms](http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-server-side-encryption.html#sqs-sse-key-terms).
*/
kmsMasterKeyId?: pulumi.Input<string>;
/**
* Limit of how many bytes a message can contain before Amazon SQS rejects it. An integer from 1024 bytes (1 KiB) up to 1048576 bytes (1024 KiB). The default for this attribute is 262144 (256 KiB).
*/
maxMessageSize?: pulumi.Input<number>;
/**
* 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).
*/
messageRetentionSeconds?: pulumi.Input<number>;
/**
* Name of the queue. Queue names must be made up of only uppercase and lowercase ASCII letters, numbers, underscores, and hyphens, and must be between 1 and 80 characters long. For a FIFO (first-in-first-out) queue, the name must end with the `.fifo` suffix. If omitted, the provider will assign a random, unique name. Conflicts with `namePrefix`.
*/
name?: pulumi.Input<string>;
/**
* Creates a unique name beginning with the specified prefix. Conflicts with `name`.
*/
namePrefix?: pulumi.Input<string>;
/**
* JSON policy for the SQS queue. For more information about building AWS IAM policy documents see the AWS IAM Policy Document Guide. The provider will only perform drift detection of its value when present in a configuration. It is preferred to use the `aws.sqs.QueuePolicy` resource instead.
*/
policy?: pulumi.Input<string>;
/**
* 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.
*/
receiveWaitTimeSeconds?: pulumi.Input<number>;
/**
* JSON policy to set up the Dead Letter Queue redrive permission, see [AWS docs](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/SQSDeadLetterQueue.html). The provider will only perform drift detection of its value when present in a configuration. It is preferred to use the `aws.sqs.RedriveAllowPolicy` resource instead.
*/
redriveAllowPolicy?: pulumi.Input<string>;
/**
* JSON policy to set up the Dead Letter Queue, see [AWS docs](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/SQSDeadLetterQueue.html). The provider will only perform drift detection of its value when present in a configuration. It is preferred to use the `aws.sqs.RedrivePolicy` resource instead. **Note:** when specifying `maxReceiveCount`, you must specify it as an integer (`5`), and not a string (`"5"`).
*/
redrivePolicy?: pulumi.Input<string>;
/**
* Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration.
*/
region?: pulumi.Input<string>;
/**
* Boolean to enable server-side encryption (SSE) of message content with SQS-owned encryption keys. See [Encryption at rest](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-server-side-encryption.html). The provider will only perform drift detection of its value when present in a configuration.
*/
sqsManagedSseEnabled?: pulumi.Input<boolean>;
/**
* Map of tags to assign to the queue. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
*/
tags?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
/**
* Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
*/
tagsAll?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
/**
* Same as `id`: The URL for the created Amazon SQS queue.
*/
url?: pulumi.Input<string>;
/**
* 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](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/AboutVT.html).
*/
visibilityTimeoutSeconds?: pulumi.Input<number>;
}
/**
* The set of arguments for constructing a Queue resource.
*/
export interface QueueArgs {
/**
* Enables content-based deduplication for FIFO queues. For more information, see the [related documentation](http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues.html#FIFO-queues-exactly-once-processing).
*/
contentBasedDeduplication?: pulumi.Input<boolean>;
/**
* Specifies whether message deduplication occurs at the message group or queue level. Valid values are `messageGroup` and `queue` (default).
*/
deduplicationScope?: pulumi.Input<string>;
/**
* 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.
*/
delaySeconds?: pulumi.Input<number>;
/**
* Boolean designating a FIFO queue. If not set, it defaults to `false` making it standard.
*/
fifoQueue?: pulumi.Input<boolean>;
/**
* Specifies whether the FIFO queue throughput quota applies to the entire queue or per message group. Valid values are `perQueue` (default) and `perMessageGroupId`.
*/
fifoThroughputLimit?: pulumi.Input<string>;
/**
* 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).
*/
kmsDataKeyReusePeriodSeconds?: pulumi.Input<number>;
/**
* ID of an AWS-managed customer master key (CMK) for Amazon SQS or a custom CMK. For more information, see [Key Terms](http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-server-side-encryption.html#sqs-sse-key-terms).
*/
kmsMasterKeyId?: pulumi.Input<string>;
/**
* Limit of how many bytes a message can contain before Amazon SQS rejects it. An integer from 1024 bytes (1 KiB) up to 1048576 bytes (1024 KiB). The default for this attribute is 262144 (256 KiB).
*/
maxMessageSize?: pulumi.Input<number>;
/**
* 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).
*/
messageRetentionSeconds?: pulumi.Input<number>;
/**
* Name of the queue. Queue names must be made up of only uppercase and lowercase ASCII letters, numbers, underscores, and hyphens, and must be between 1 and 80 characters long. For a FIFO (first-in-first-out) queue, the name must end with the `.fifo` suffix. If omitted, the provider will assign a random, unique name. Conflicts with `namePrefix`.
*/
name?: pulumi.Input<string>;
/**
* Creates a unique name beginning with the specified prefix. Conflicts with `name`.
*/
namePrefix?: pulumi.Input<string>;
/**
* JSON policy for the SQS queue. For more information about building AWS IAM policy documents see the AWS IAM Policy Document Guide. The provider will only perform drift detection of its value when present in a configuration. It is preferred to use the `aws.sqs.QueuePolicy` resource instead.
*/
policy?: pulumi.Input<string>;
/**
* 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.
*/
receiveWaitTimeSeconds?: pulumi.Input<number>;
/**
* JSON policy to set up the Dead Letter Queue redrive permission, see [AWS docs](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/SQSDeadLetterQueue.html). The provider will only perform drift detection of its value when present in a configuration. It is preferred to use the `aws.sqs.RedriveAllowPolicy` resource instead.
*/
redriveAllowPolicy?: pulumi.Input<string>;
/**
* JSON policy to set up the Dead Letter Queue, see [AWS docs](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/SQSDeadLetterQueue.html). The provider will only perform drift detection of its value when present in a configuration. It is preferred to use the `aws.sqs.RedrivePolicy` resource instead. **Note:** when specifying `maxReceiveCount`, you must specify it as an integer (`5`), and not a string (`"5"`).
*/
redrivePolicy?: pulumi.Input<string>;
/**
* Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration.
*/
region?: pulumi.Input<string>;
/**
* Boolean to enable server-side encryption (SSE) of message content with SQS-owned encryption keys. See [Encryption at rest](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-server-side-encryption.html). The provider will only perform drift detection of its value when present in a configuration.
*/
sqsManagedSseEnabled?: pulumi.Input<boolean>;
/**
* Map of tags to assign to the queue. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
*/
tags?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
/**
* 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](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/AboutVT.html).
*/
visibilityTimeoutSeconds?: pulumi.Input<number>;
}