|
| 1 | +# aws-iot-sqs module |
| 2 | +<!--BEGIN STABILITY BANNER--> |
| 3 | + |
| 4 | +--- |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | +> All classes are under active development and subject to non-backward compatible changes or removal in any |
| 9 | +> future version. These are not subject to the [Semantic Versioning](https://semver.org/) model. |
| 10 | +> This means that while you may use them, you may need to update your source code when upgrading to a newer version of this package. |
| 11 | +
|
| 12 | +--- |
| 13 | +<!--END STABILITY BANNER--> |
| 14 | + |
| 15 | +| **Reference Documentation**:| <span style="font-weight: normal">https://docs.aws.amazon.com/solutions/latest/constructs/</span>| |
| 16 | +|:-------------|:-------------| |
| 17 | +<div style="height:8px"></div> |
| 18 | + |
| 19 | +| **Language** | **Package** | |
| 20 | +|:-------------|-----------------| |
| 21 | +| Python|`aws_solutions_constructs.aws_iot_sqs`| |
| 22 | +| Typescript|`@aws-solutions-constructs/aws-iot-sqs`| |
| 23 | +| Java|`software.amazon.awsconstructs.services.iotsqs`| |
| 24 | + |
| 25 | +This AWS Solutions Construct implements an AWS IoT MQTT topic rule and an AWS SQS Queue pattern. |
| 26 | + |
| 27 | +Here is a minimal deployable pattern definition in Typescript: |
| 28 | + |
| 29 | +``` typescript |
| 30 | +const { IotToSqsProps, IotToSqs } from '@aws-solutions-constructs/aws-iot-sqs'; |
| 31 | + |
| 32 | +const props: IotToSqsProps = { |
| 33 | + iotTopicRuleProps: { |
| 34 | + topicRulePayload: { |
| 35 | + ruleDisabled: false, |
| 36 | + description: "Testing the IotToSqs Pattern", |
| 37 | + sql: "SELECT * FROM 'iot/sqs/#'", |
| 38 | + actions: [] |
| 39 | + } |
| 40 | + } |
| 41 | +}; |
| 42 | + |
| 43 | +new IotToSqs(this, 'test-iot-sqs-integration', props); |
| 44 | +``` |
| 45 | + |
| 46 | +## Initializer |
| 47 | + |
| 48 | +``` text |
| 49 | +new IotToSqs(scope: Construct, id: string, props: IotToSqsProps); |
| 50 | +``` |
| 51 | + |
| 52 | +_Parameters_ |
| 53 | + |
| 54 | +* scope [`Construct`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_core.Construct.html) |
| 55 | +* id `string` |
| 56 | +* props [`IotToSqsProps`](#pattern-construct-props) |
| 57 | + |
| 58 | +## Pattern Construct Props |
| 59 | + |
| 60 | +| **Name** | **Type** | **Description** | |
| 61 | +|:-------------|:----------------|-----------------| |
| 62 | +|existingQueueObj?|[`sqs.Queue`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-sqs.Queue.html)|Existing instance of SQS queue object, providing both this and `queueProps` will cause an error.| |
| 63 | +|queueProps?|[`sqs.QueueProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-sqs.QueueProps.html)|User provided props to override the default props for the SQS queue.| |
| 64 | +|deadLetterQueueProps?|[`sqs.QueueProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-sqs.QueueProps.html)|Optional user provided properties for the dead letter queue.| |
| 65 | +|deployDeadLetterQueue?|`boolean`|Whether to deploy a secondary queue to be used as a dead letter queue. Default `true`.| |
| 66 | +|maxReceiveCount?|`number`|The number of times a message can be unsuccessfully dequeued before being moved to the dead-letter queue. Required field if `deployDeadLetterQueue`=`true`.| |
| 67 | +|enableEncryptionWithCustomerManagedKey?|`boolean`|Use a KMS Key, either managed by this CDK app, or imported. If importing an encryption key, it must be specified in the `encryptionKey` property for this construct.| |
| 68 | +|encryptionKey?|[`kms.Key`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-kms.Key.html)|An optional, imported encryption key to encrypt the SQS queue, and SNS Topic.| |
| 69 | +|encryptionKeyProps?|[`kms.KeyProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-kms.KeyProps.html)|Optional user-provided props to override the default props for the encryption key.| |
| 70 | +|iotTopicRuleProps?|[`iot.CfnTopicRuleProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-iot.CfnTopicRuleProps.html)|User provided CfnTopicRuleProps to override the defaults| |
| 71 | + |
| 72 | +## Pattern Properties |
| 73 | + |
| 74 | +| **Name** | **Type** | **Description** | |
| 75 | +|:-------------|:----------------|-----------------| |
| 76 | +|encryptionKey?|[`kms.Key`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-kms.Key.html)|Returns an instance of `kms.Key` used for the SQS queue.| |
| 77 | +|iotRole|[`iam.Role`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-iam.Role.html)|Returns an instance of `iam.Role` created by the construct, which allows IoT to publish messages to the SQS Queue| |
| 78 | +|sqsQueue|[`sqs.Queue`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-sqs.Queue.html)|Returns an instance of `sqs.Queue` created by the construct| |
| 79 | +|deadLetterQueue?|[`sqs.Queue`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-sqs.Queue.html)|Returns an instance of the dead-letter SQS queue created by the pattern.| |
| 80 | +|iotTopicRule|[`iot.CfnTopicRule`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-iot.CfnTopicRule.html)|Returns an instance of `iot.CfnTopicRule` created by the construct| |
| 81 | + |
| 82 | +## Default settings |
| 83 | + |
| 84 | +Out of the box implementation of the Construct without any override will set the following defaults: |
| 85 | + |
| 86 | +### Amazon IoT Rule |
| 87 | +* Configure an IoT Rule to send messages to the SQS Queue |
| 88 | + |
| 89 | +### Amazon IAM Role |
| 90 | +* Configure least privilege access IAM role for Amazon IoT to be able to publish messages to the SQS Queue |
| 91 | + |
| 92 | +### Amazon SQS Queue |
| 93 | +* Deploy a dead-letter queue for the source queue. |
| 94 | +* Enable server-side encryption for the source queue using a customer-managed AWS KMS key. |
| 95 | +* Enforce encryption of data in transit. |
| 96 | + |
| 97 | +## Architecture |
| 98 | + |
| 99 | + |
| 100 | +*** |
| 101 | +© Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. |
0 commit comments