{"id":14957782,"url":"https://github.com/robertpeteuil/terraform-aws-sns-to-cloudwatch-logs-lambda","last_synced_at":"2025-10-24T12:30:49.648Z","repository":{"id":39878281,"uuid":"142709881","full_name":"robertpeteuil/terraform-aws-sns-to-cloudwatch-logs-lambda","owner":"robertpeteuil","description":"Terraform Module to provision Lambda Function that routes SNS messages to CloudWatch Logs","archived":true,"fork":false,"pushed_at":"2023-06-08T18:08:25.000Z","size":15598,"stargazers_count":7,"open_issues_count":2,"forks_count":14,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-31T01:07:27.978Z","etag":null,"topics":["aws-cloudwatch-logs","aws-lambda","aws-lambda-python","aws-sns","cloudwatch-logs","hashicorp-terraform","hcl2","lambda","sns","sns-messages","terraform-module","terraform-modules"],"latest_commit_sha":null,"homepage":"","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/robertpeteuil.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-28T21:01:34.000Z","updated_at":"2025-01-23T16:58:46.000Z","dependencies_parsed_at":"2024-09-22T04:02:16.909Z","dependency_job_id":"94f1ed9e-0172-4973-a630-79295b5b0cd1","html_url":"https://github.com/robertpeteuil/terraform-aws-sns-to-cloudwatch-logs-lambda","commit_stats":{"total_commits":41,"total_committers":1,"mean_commits":41.0,"dds":0.0,"last_synced_commit":"d4e17839911fc334fc70509f702f48ff2ce4c0f1"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertpeteuil%2Fterraform-aws-sns-to-cloudwatch-logs-lambda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertpeteuil%2Fterraform-aws-sns-to-cloudwatch-logs-lambda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertpeteuil%2Fterraform-aws-sns-to-cloudwatch-logs-lambda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertpeteuil%2Fterraform-aws-sns-to-cloudwatch-logs-lambda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robertpeteuil","download_url":"https://codeload.github.com/robertpeteuil/terraform-aws-sns-to-cloudwatch-logs-lambda/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237964477,"owners_count":19394407,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws-cloudwatch-logs","aws-lambda","aws-lambda-python","aws-sns","cloudwatch-logs","hashicorp-terraform","hcl2","lambda","sns","sns-messages","terraform-module","terraform-modules"],"created_at":"2024-09-24T13:15:34.428Z","updated_at":"2025-10-24T12:30:49.038Z","avatar_url":"https://github.com/robertpeteuil.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# terraform-aws-sns-to-cloudwatch-logs-lambda\n\n[![Latest Release](https://img.shields.io/github/release/robertpeteuil/terraform-aws-sns-to-cloudwatch-logs-lambda.svg)](https://github.com/robertpeteuil/terraform-aws-sns-to-cloudwatch-logs-lambda) [![license](https://img.shields.io/github/license/robertpeteuil/terraform-aws-sns-to-cloudwatch-logs-lambda.svg?colorB=2067b8)](https://github.com/robertpeteuil/terraform-aws-sns-to-cloudwatch-logs-lambda)\n\n`terraform-aws-sns-to-cloudwatch-logs-lambda` is a Terraform module to provision a Lambda Function which routes SNS messages to CloudWatch Logs\n\n- Terraform versions \u003e= 0.12, use module `version \u003e= \"3.0.1\"` (See exception)\n- Terraform versions \u003c= 0.11, use module `version = \"1.0.1\"`\n\n\u003e Exception: if using `var.aws_region` to specify deployment region, use `version = \"2.0.1\"`, until you can switch to provider aliases and [explicit provider passing](https://www.terraform.io/docs/configuration/modules.html#passing-providers-explicitly).\n\n## Terraform Module Features\n\nThis Module allows simple and rapid deployment\n\n- Creates Lambda function, Lambda Layer, IAM Policies, Triggers, and Subscriptions\n- Creates (or use existing) SNS Topic, CloudWatch Log Group and Log Group Stream\n- Options:\n  - Create CloudWatch Event to prevent Function hibernation\n  - Set Log Group retention period\n- Python function editable in repository and in Lambda UI\n  - Python dependencies packages in Lambda Layers zip\n- Optionally create custom Lambda Layer zip using [build-lambda-layer-python](https://github.com/robertpeteuil/build-lambda-layer-python)\n  - Enables adding/changing dependencies\n  - Enables compiling for different version of Python\n- **Breaking Changes** in `3.0.0` - required to enable new Terraform 0.13 module arguments `for_each`, `count`, and `depends_on`\n  - The module's internal AWS `provider` block has been removed\n  - `var.aws_region` has been removed and can't be used to set a target region\n  - By default, modules inherit the `region` of the calling module's Provider\n  - To specify alternate regions, use provider aliases and [expicit provider passing](https://www.terraform.io/docs/configuration/modules.html#passing-providers-explicitly)\n  - Additional information on module considerations can be found in the docs for [Provider Configuration in Modules with 0.13](https://www.terraform.io/docs/configuration/modules.html#legacy-shared-modules-with-provider-configurations)\n\n## SNS to CloudWatch Logs Features\n\nThis Lambda Function forwards subject \u0026 body of SNS messages to CloudWatch Log Group Stream\n\n- Enhances the value of CloudWatch Logs by enabling easy entry creation from any service, function and script that can send SNS notifications\n- Enables cloud-init, bootstraps and functions to easily write log entries to a centralized CloudWatch Log\n- Simplifies troubleshooting of solutions with decentralized logic\n  - scripts and functions spread across instances, Lambda and services\n- Easily add instrumentation to scripts: `aws sns publish --topic-arn $TOPIC_ARN --message $LOG_ENTRY`\n  - Use with IAM instance policy requires `--region $AWS_REGION` parameter\n\n## Usage\n\n``` ruby\nmodule \"sns_logger\" {\n  source            = \"robertpeteuil/sns-to-cloudwatch-logs-lambda/aws\"\n  version           = \"3.0.1\"     # Use with Terraform \u003e= 0.12 (including 0.13)\n  # version           = \"1.0.1\"   # Latest version for Terraform \u003c= 0.11\n\n  sns_topic_name    = \"projectx-logging\"\n  log_group_name    = \"projectx\"\n  log_stream_name   = \"script-logs\"\n}\n```\n\n\u003e NOTE: Make sure you are using [version pinning](https://www.terraform.io/docs/modules/usage.html#module-versions) to avoid unexpected changes when the module is updated.\n\n## Required Inputs\n\n| Name | Description | Type | Default | Required |\n|------|-------------|:----:|:-----:|:-----:|\n| sns_topic_name | Name of SNS Topic to be logged by Gateway | string | - | yes |\n| log_group_name | Name of CloudWatch Log Group | string | - | yes |\n| log_stream_name | Name of CloudWatch Log Stream | string | - | yes |\n\n## Optional Inputs\n\n| Name | Description | Type | Default | Required |\n|------|-------------|:----:|:-----:|:-----:|\n| create_sns_topic | Create new SNS topic | string | `true` | no |\n| create_log_group | Create new log group | string | `true` | no |\n| create_log_stream | Create new log stream | string | `true` | no |\n| log_group_retention_days | Log Group retention (days) | string | `0` (forever) | no |\n| lambda_func_name | Name for Lambda Function | string | dynamically calculated | no |\n| lambda_description | Lambda Function Description | string | `Route SNS messages to CloudWatch Logs` | no |\n| lambda_tags | Mapping of Tags to assign to Lambda function | map | `{}` | no |\n| lambda_publish_func | Publish Lambda Function | string | `false` | no |\n| lambda_runtime | Lambda runtime for Function | string | `python3.6` | no |\n| lambda_timeout | Function time-out (seconds) | string | `3` | no |\n| lambda_mem_size | Function RAM assigned (MB) | string | `128` | no |\n| create_warmer_event | Create CloudWatch trigger event to prevent hibernation | string | `false` | no |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobertpeteuil%2Fterraform-aws-sns-to-cloudwatch-logs-lambda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobertpeteuil%2Fterraform-aws-sns-to-cloudwatch-logs-lambda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobertpeteuil%2Fterraform-aws-sns-to-cloudwatch-logs-lambda/lists"}