UNPKG

2.08 kBMarkdownView Raw
1# Amazon Simple Queue Service Construct Library
2<!--BEGIN STABILITY BANNER-->
3
4---
5
6![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge)
7
8![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge)
9
10---
11
12<!--END STABILITY BANNER-->
13
14Amazon Simple Queue Service (SQS) is a fully managed message queuing service that
15enables you to decouple and scale microservices, distributed systems, and serverless
16applications. SQS eliminates the complexity and overhead associated with managing and
17operating message oriented middleware, and empowers developers to focus on differentiating work.
18Using SQS, you can send, store, and receive messages between software components at any volume,
19without losing messages or requiring other services to be available.
20
21## Installation
22
23Import to your project:
24
25```ts nofixture
26import * as sqs from '@aws-cdk/aws-sqs';
27```
28
29## Basic usage
30
31
32Here's how to add a basic queue to your application:
33
34```ts
35new sqs.Queue(this, 'Queue');
36```
37
38## Encryption
39
40If you want to encrypt the queue contents, set the `encryption` property. You can have
41the messages encrypted with a key that SQS manages for you, or a key that you
42can manage yourself.
43
44```ts
45// Use managed key
46new sqs.Queue(this, 'Queue', {
47 encryption: sqs.QueueEncryption.KMS_MANAGED,
48});
49
50// Use custom key
51const myKey = new kms.Key(this, 'Key');
52
53new sqs.Queue(this, 'Queue', {
54 encryption: sqs.QueueEncryption.KMS,
55 encryptionMasterKey: myKey,
56});
57```
58
59## First-In-First-Out (FIFO) queues
60
61FIFO queues give guarantees on the order in which messages are dequeued, and have additional
62features in order to help guarantee exactly-once processing. For more information, see
63the SQS manual. Note that FIFO queues are not available in all AWS regions.
64
65A queue can be made a FIFO queue by either setting `fifo: true`, giving it a name which ends
66in `".fifo"`, or by enabling a FIFO specific feature such as: content-based deduplication,
67deduplication scope or fifo throughput limit.