UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

209 lines • 8.79 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.Queue = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * 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 */ 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, id, state, opts) { return new Queue(name, state, { ...opts, id: id }); } /** * 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) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === Queue.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["arn"] = state?.arn; resourceInputs["contentBasedDeduplication"] = state?.contentBasedDeduplication; resourceInputs["deduplicationScope"] = state?.deduplicationScope; resourceInputs["delaySeconds"] = state?.delaySeconds; resourceInputs["fifoQueue"] = state?.fifoQueue; resourceInputs["fifoThroughputLimit"] = state?.fifoThroughputLimit; resourceInputs["kmsDataKeyReusePeriodSeconds"] = state?.kmsDataKeyReusePeriodSeconds; resourceInputs["kmsMasterKeyId"] = state?.kmsMasterKeyId; resourceInputs["maxMessageSize"] = state?.maxMessageSize; resourceInputs["messageRetentionSeconds"] = state?.messageRetentionSeconds; resourceInputs["name"] = state?.name; resourceInputs["namePrefix"] = state?.namePrefix; resourceInputs["policy"] = state?.policy; resourceInputs["receiveWaitTimeSeconds"] = state?.receiveWaitTimeSeconds; resourceInputs["redriveAllowPolicy"] = state?.redriveAllowPolicy; resourceInputs["redrivePolicy"] = state?.redrivePolicy; resourceInputs["region"] = state?.region; resourceInputs["sqsManagedSseEnabled"] = state?.sqsManagedSseEnabled; resourceInputs["tags"] = state?.tags; resourceInputs["tagsAll"] = state?.tagsAll; resourceInputs["url"] = state?.url; resourceInputs["visibilityTimeoutSeconds"] = state?.visibilityTimeoutSeconds; } else { const args = argsOrState; resourceInputs["contentBasedDeduplication"] = args?.contentBasedDeduplication; resourceInputs["deduplicationScope"] = args?.deduplicationScope; resourceInputs["delaySeconds"] = args?.delaySeconds; resourceInputs["fifoQueue"] = args?.fifoQueue; resourceInputs["fifoThroughputLimit"] = args?.fifoThroughputLimit; resourceInputs["kmsDataKeyReusePeriodSeconds"] = args?.kmsDataKeyReusePeriodSeconds; resourceInputs["kmsMasterKeyId"] = args?.kmsMasterKeyId; resourceInputs["maxMessageSize"] = args?.maxMessageSize; resourceInputs["messageRetentionSeconds"] = args?.messageRetentionSeconds; resourceInputs["name"] = args?.name; resourceInputs["namePrefix"] = args?.namePrefix; resourceInputs["policy"] = args?.policy; resourceInputs["receiveWaitTimeSeconds"] = args?.receiveWaitTimeSeconds; resourceInputs["redriveAllowPolicy"] = args?.redriveAllowPolicy; resourceInputs["redrivePolicy"] = args?.redrivePolicy; resourceInputs["region"] = args?.region; resourceInputs["sqsManagedSseEnabled"] = args?.sqsManagedSseEnabled; resourceInputs["tags"] = args?.tags; resourceInputs["visibilityTimeoutSeconds"] = args?.visibilityTimeoutSeconds; resourceInputs["arn"] = undefined /*out*/; resourceInputs["tagsAll"] = undefined /*out*/; resourceInputs["url"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Queue.__pulumiType, name, resourceInputs, opts); } } exports.Queue = Queue; /** @internal */ Queue.__pulumiType = 'aws:sqs/queue:Queue'; //# sourceMappingURL=queue.js.map