|
| 1 | +# EventPub Module |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +The `eventpub` module provides a centralized event publishing infrastructure for NHS Notify bounded contexts. It creates an SNS topic with configurable subscribers (Lambda, Firehose, SQS) and includes comprehensive monitoring via CloudWatch alarms. |
| 6 | + |
| 7 | +``` |
| 8 | +┌─────────────────┐ |
| 9 | +│ Service Lambda │ |
| 10 | +│ (Publisher) │ |
| 11 | +└────────┬────────┘ |
| 12 | + │ publishes to |
| 13 | + ▼ |
| 14 | +┌─────────────────────────┐ |
| 15 | +│ SNS Topic │ |
| 16 | +│ (eventpub module) │ |
| 17 | +│ │ |
| 18 | +│ - Anomaly Detection │ |
| 19 | +│ - Delivery Logging │ |
| 20 | +│ - KMS Encryption │ |
| 21 | +└─────────┬───────────────┘ |
| 22 | + │ fan-out to: |
| 23 | + ├─────────────────────────┐ |
| 24 | + │ │ |
| 25 | + ▼ ▼ |
| 26 | +┌─────────────────┐ ┌──────────────────┐ |
| 27 | +│ Kinesis │ │ EventBridge │ |
| 28 | +│ Firehose │ │ Rules │ |
| 29 | +│ ↓ S3 │ │ ↓ Subscribers │ |
| 30 | +│ (Event Cache) │ │ (SQS/Lambda) │ |
| 31 | +└─────────────────┘ └──────────────────┘ |
| 32 | + │ │ |
| 33 | + ▼ ▼ |
| 34 | +┌─────────────────┐ ┌──────────────────┐ |
| 35 | +│ CloudWatch │ │ CloudWatch │ |
| 36 | +│ - DLQ Alarm │ │ - Anomaly │ |
| 37 | +│ - Delivery │ │ Detection │ |
| 38 | +│ Failures │ │ │ |
| 39 | +└─────────────────┘ └──────────────────┘ |
| 40 | +``` |
| 41 | + |
1 | 42 | <!-- BEGIN_TF_DOCS --> |
2 | 43 | <!-- markdownlint-disable --> |
3 | 44 | <!-- vale off --> |
|
19 | 60 | | <a name="input_default_tags"></a> [default\_tags](#input\_default\_tags) | Default tag map for application to all taggable resources in the module | `map(string)` | `{}` | no | |
20 | 61 | | <a name="input_enable_event_cache"></a> [enable\_event\_cache](#input\_enable\_event\_cache) | Enable caching of events to an S3 bucket | `bool` | `false` | no | |
21 | 62 | | <a name="input_enable_firehose_raw_message_delivery"></a> [enable\_firehose\_raw\_message\_delivery](#input\_enable\_firehose\_raw\_message\_delivery) | Enables raw message delivery on firehose subscription | `bool` | `false` | no | |
| 63 | +| <a name="input_enable_event_publishing_anomaly_detection"></a> [enable\_publishing\_anomaly\_detection](#input\_enable\_publishing\_anomaly\_detection) | Enable CloudWatch anomaly detection alarm for SNS message publishing. Detects abnormal drops or spikes in event publishing volume. | `bool` | `true` | no | |
22 | 64 | | <a name="input_enable_sns_delivery_logging"></a> [enable\_sns\_delivery\_logging](#input\_enable\_sns\_delivery\_logging) | Enable SNS Delivery Failure Notifications | `bool` | `false` | no | |
23 | 65 | | <a name="input_environment"></a> [environment](#input\_environment) | The name of the terraformscaffold environment the module is called for | `string` | n/a | yes | |
24 | 66 | | <a name="input_event_cache_buffer_interval"></a> [event\_cache\_buffer\_interval](#input\_event\_cache\_buffer\_interval) | The buffer interval for data firehose | `number` | `500` | no | |
|
31 | 73 | | <a name="input_log_retention_in_days"></a> [log\_retention\_in\_days](#input\_log\_retention\_in\_days) | The retention period in days for the Cloudwatch Logs events generated by the lambda function | `number` | n/a | yes | |
32 | 74 | | <a name="input_name"></a> [name](#input\_name) | A unique name to distinguish this module invocation from others within the same CSI scope | `string` | n/a | yes | |
33 | 75 | | <a name="input_project"></a> [project](#input\_project) | The name of the terraformscaffold project calling the module | `string` | n/a | yes | |
| 76 | +| <a name="input_event_publishing_anomaly_band_width"></a> [publishing\_anomaly\_band\_width](#input\_publishing\_anomaly\_band\_width) | The width of the anomaly detection band. Higher values (e.g., 4-6) reduce sensitivity and noise, lower values (e.g., 2-3) increase sensitivity. Recommended: 2-4 depending on traffic patterns. | `number` | `3` | no | |
| 77 | +| <a name="input_event_publishing_anomaly_evaluation_periods"></a> [publishing\_anomaly\_evaluation\_periods](#input\_publishing\_anomaly\_evaluation\_periods) | Number of evaluation periods for the publishing anomaly alarm. Each period is defined by event_publishing_anomaly_period. | `number` | `2` | no | |
| 78 | +| <a name="input_event_publishing_anomaly_period"></a> [publishing\_anomaly\_period](#input\_publishing\_anomaly\_period) | The period in seconds over which the specified statistic is applied for anomaly detection. Minimum 300 seconds (5 minutes). Recommended: 300-600 for event-driven workloads. | `number` | `300` | no | |
34 | 79 | | <a name="input_region"></a> [region](#input\_region) | The AWS Region | `string` | n/a | yes | |
35 | 80 | | <a name="input_sns_success_logging_sample_percent"></a> [sns\_success\_logging\_sample\_percent](#input\_sns\_success\_logging\_sample\_percent) | Enable SNS Delivery Successful Sample Percentage | `number` | `0` | no | |
36 | 81 | ## Modules |
|
42 | 87 |
|
43 | 88 | | Name | Description | |
44 | 89 | |------|-------------| |
| 90 | +| <a name="output_publishing_anomaly_alarm"></a> [publishing\_anomaly\_alarm](#output\_publishing\_anomaly\_alarm) | CloudWatch anomaly detection alarm details for SNS publishing | |
45 | 91 | | <a name="output_s3_bucket_event_cache"></a> [s3\_bucket\_event\_cache](#output\_s3\_bucket\_event\_cache) | S3 Bucket ARN and Name for event cache | |
46 | 92 | | <a name="output_sns_topic"></a> [sns\_topic](#output\_sns\_topic) | SNS Topic ARN and Name | |
47 | 93 | <!-- vale on --> |
|
0 commit comments