{"id":20471736,"url":"https://github.com/signiant/sns-topic-pruner","last_synced_at":"2026-06-01T08:31:55.599Z","repository":{"id":196414714,"uuid":"696053448","full_name":"Signiant/sns-topic-pruner","owner":"Signiant","description":"A tool that deletes all subscriber-less SNS topics not being used as CloudFormation stack resources in an AWS account and posts a report to slack.","archived":false,"fork":false,"pushed_at":"2023-10-25T03:21:56.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-05T13:48:59.854Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","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/Signiant.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2023-09-25T01:31:36.000Z","updated_at":"2023-09-25T14:39:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"4b87dd30-9d18-4c37-8ed4-c204d613d2ae","html_url":"https://github.com/Signiant/sns-topic-pruner","commit_stats":null,"previous_names":["signiant/sns-topic-pruner"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Signiant/sns-topic-pruner","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Signiant%2Fsns-topic-pruner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Signiant%2Fsns-topic-pruner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Signiant%2Fsns-topic-pruner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Signiant%2Fsns-topic-pruner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Signiant","download_url":"https://codeload.github.com/Signiant/sns-topic-pruner/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Signiant%2Fsns-topic-pruner/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33767435,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-01T02:00:06.963Z","response_time":115,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-15T14:17:06.541Z","updated_at":"2026-06-01T08:31:55.579Z","avatar_url":"https://github.com/Signiant.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sns-topic-pruner\n\nA tool that deletes all subscriber-less SNS topics not being used as CloudFormation stack resources in an AWS account\nand posts a report to slack.\n\nIn addition to the base script, a CloudFormation template is included to facilitate the creation of a scheduled Lambda.\n\n## Requirements\n\nAlongside **Python 3.11+**, the following packages must be installed to run this tool:\n- boto3\n- requests\n\nAdditionally, you need to have both AWS CLI \u0026 AWS SAM CLI installed and configured. The following guides provide \ndetailed instructions on how to do so:\n1. [Install or update the latest version of the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)\n2. [Set up the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-quickstart.html)\n3. [Installing the AWS SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/install-sam-cli.html)\n\n\n## Setup\n\nThere are two ways to use this tool: through local execution or a scheduled lambda.\n\n### Running the script locally\n\n1. Clone this repository or download the most recent release.\n2. Export a webhook to the desired Slack channel for the report as an environment variable called \n   **SLACK_WEBHOOK_URL**\n3. In the same folder as the script, run the following command (with the addition of any arguments from the list below):  \n   `$ python -m sns-topic-pruner -p [PROFILES ...]`\n\nCommand line argument reference:\n\n|      Option      | Description                               |  Required  |        Default        |\n|:----------------:|-------------------------------------------|:----------:|:---------------------:|\n|  -p, --profiles  | A list of profiles to prune the topics of |    Yes     |          N/A          |\n|  -o, --override  | A list of topics to ignore                |     No     |         None          |\n|  -r, --regions   | A list of regions to prune through        |     No     |  All Enabled Regions  |\n|  -v, --verbose   | Output more info in logs during execution |     No     |         False         |\n|  -d, --dry-run   | Execute without making changes            |     No     |         False         |\n|    -h, --help    | Show help message and exit                |     No     |          N/A          |\n\n\n### Deploying the Lambda function\n\n1. Clone this repository or download the most recent release.\n2. In template.yaml, replace each commented line with relevant data. Refer to the **Lambda event variable** \ntable below when filling out the **Input** property.\n3. In sns_topic_pruner.py, replace the **EXTERNAL_ID** global variable string with the ExternalId specified in \ntemplate.yaml.\n4. In the same directory as the template file, create the build directory for the project using the following command:  \n`$ sam build`\n5. Deploy the development Lambda function and associated IAM role with the following command:  \n`$ sam deploy --stack-name TEXT --s3-bucket TEXT --s3-prefix TEXT --region TEXT`  \nOR  \nDeploy the production Lambda function and associated IAM role, meaning it will run on a schedule, with the following \ncommand:  \n`$ sam deploy --stack-name TEXT --s3-bucket TEXT --s3-prefix TEXT --region TEXT --parameter-overrides \"EnvName=\"prod\"\"`  \n(Optional) *Create an AWS SAM CLI config file to skip entering these arguments every time you want to deploy. Learn about that \n[here](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-config.html).*\n\n\nLambda event variable reference:\n\n|  Event Variable  | Description                                      |  Required  |        Default        |\n|:----------------:|--------------------------------------------------|:----------:|:---------------------:|\n| account_numbers  | A list of account numbers to prune the topics of |    Yes     |          N/A          |\n|    overrides     | A list of topics to ignore                       |     No     |         None          |\n|     regions      | A list of regions to prune through               |     No     |  All Enabled Regions  |\n|     verbose      | Output more info in logs during execution        |     No     |         True          |\n|     dry_run      | Execute without making changes                   |     No     |         True          |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsigniant%2Fsns-topic-pruner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsigniant%2Fsns-topic-pruner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsigniant%2Fsns-topic-pruner/lists"}