{"id":49061248,"url":"https://github.com/techdroplabs/rdscheck","last_synced_at":"2026-04-20T02:01:52.283Z","repository":{"id":64302541,"uuid":"196060492","full_name":"techdroplabs/rdscheck","owner":"techdroplabs","description":"Lambda Functions to copy, restore and validate RDS snapshots","archived":false,"fork":false,"pushed_at":"2020-02-07T21:54:08.000Z","size":1740,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-07-01T05:39:40.220Z","etag":null,"topics":["aws","aws-lambda","aws-rds-postgres","golang","lambda","lambda-functions","postgres","postresql","terraform"],"latest_commit_sha":null,"homepage":"","language":"Go","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/techdroplabs.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}},"created_at":"2019-07-09T18:17:20.000Z","updated_at":"2023-07-20T12:58:31.000Z","dependencies_parsed_at":"2023-01-15T09:45:31.432Z","dependency_job_id":null,"html_url":"https://github.com/techdroplabs/rdscheck","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/techdroplabs/rdscheck","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techdroplabs%2Frdscheck","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techdroplabs%2Frdscheck/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techdroplabs%2Frdscheck/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techdroplabs%2Frdscheck/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/techdroplabs","download_url":"https://codeload.github.com/techdroplabs/rdscheck/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techdroplabs%2Frdscheck/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32029857,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T00:18:06.643Z","status":"online","status_checked_at":"2026-04-20T02:00:06.527Z","response_time":94,"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":["aws","aws-lambda","aws-rds-postgres","golang","lambda","lambda-functions","postgres","postresql","terraform"],"created_at":"2026-04-20T02:01:51.521Z","updated_at":"2026-04-20T02:01:52.277Z","avatar_url":"https://github.com/techdroplabs.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rdscheck\n+ Copy command will:\n    - Copy snapshot(s) to a different AWS region in the same account. This will copy only automated snapshots.\n    - Cleanup old snapshots based on retention setup in the yaml config file\n+ Check command will:\n    - Creates new rds instance(s) with the snapshots\n    - Runs a set of queries on the database to validate the content of the backup\n\n## TODO\n\n- Handle things gracefully when there is more than 5 snapshots to copy\n- Handle different retentions between automatic and manual backups. (tag automatic snapshot with something like \"CopiedBy\" \"rdscheck\" and skip if set)\n\n## check: state machine diagram\n\n![state machine](/img/state-machine.png)\n\n## yaml configuration file\n\n+ instances: `all the rds instances that we want to copy/restore/check to an AWS region.`\n    - name: `the name of the source rds instance`\n    - database: `the name of the databse that we copied and restored we use this field to initiate the db connection`\n    - type: `the rds instance type we want to use to restore the snapshot`\n    - password: `the password that we will use to connect to the database. It doesn't need to be the original one. We will use this one to reset the original password`\n    - retention: `how many days we want to keep the copied snapshot around. Right now it should be equal to the number of days the automatic backups are kept`\n    - destination: `the aws region where we will copy/restore the snapshot`\n    - kmsid: `the id (ARN) of the kms key that you want to use on the destination region. This is needed if your original snapshot is encrypted`\n    - queries: `all the sql queries we want to run on the restored snapshot to validate it and the expected results as regex`\n      - query: `the sql query to run`\n      - regex: `the regex of the expected result`\n\nExample:\n```yaml\ninstances:\n  - name: rdscheck\n    database: rdscheck\n    type: db.t2.micro\n    password: thisisatest\n    retention: 1\n    destination: us-east-1\n    kmsid: \"arn:aws:kms:us-east-1:1234567890:key/123456-7890-123456\"\n    queries:\n      - query: \"SELECT tablename FROM pg_catalog.pg_tables;\"\n        regex: \"^pg_statistic$\"\n  - name: rdscheck2\n    database: rdscheck\n    type: db.t2.micro\n    password: thisisatest\n    retention: 10\n    destination: us-east-2\n    queries:\n      - query: \"SELECT tablename FROM pg_catalog.pg_tables;\"\n        regex: \"^pg_statistic$\"\n```\n\n## Releases\n\nGithub Workflow is setup to create a new release when a tag is created and pushed.\n[.github/workflows/release.yml](.github/workflows/release.yml) will get triggered, will create a new release, build the commands and upload them as two seperate zip files in the release.\nBy doing so we can then download the command zip file for a release and use it when creating a lambda function with terraform.\n\n## Terraform\n\n```hcl\n\nmodule \"rdscheck-copy\" {\n  source = \"github.com/techdroplabs/rdscheck//terraform?ref=v0.0.9\"\n\n  release_version = \"v0.0.9\"\n  command = \"copy\"\n  lambda_env_vars {\n    variables = {\n      S3_BUCKET         = \"s3-bucket-with-yaml-file\"\n      S3_KEY            = \"rdscheck.yml\"\n      AWS_REGION_SOURCE = \"us-west-2\"\n      DD_API_KEY        = \"lked78t4iuhweoih8oi\"\n      DD_APP_KEY        = \"lknsdc8754liwhefp90\"\n    }\n  }\n}\n\n```\n\n```hcl\n\nmodule \"rdscheck-check\" {\n  source = \"github.com/techdroplabs/rdscheck//terraform?ref=v0.0.9\"\n\n  lambda_rate = \"rate(30 minutes)\"\n  release_version = \"v0.0.9\"\n  command = \"check\"\n  subnet_ids = [\"subnet-12345,subnet-6789\"]\n  security_group_ids = [\"sg-1234,sg-5678\"]\n  lambda_env_vars {\n    variables = {\n      S3_BUCKET         = \"s3-bucket-with-yaml-file\"\n      S3_KEY            = \"rdscheck.yml\"\n      AWS_REGION_SOURCE = \"us-west-2\"\n      AWS_SG_IDS        = \"sg-1234,sg-5678\"\n      AWS_SUBNETS_IDS   = \"subnet-qwerty1234576,subnet-azerty123456\"\n      DD_API_KEY        = \"lked78t4iuhweoih8oi\"\n      DD_APP_KEY        = \"lknsdc8754liwhefp90\"\n    }\n  }\n}\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechdroplabs%2Frdscheck","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftechdroplabs%2Frdscheck","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechdroplabs%2Frdscheck/lists"}