{"id":18820410,"url":"https://github.com/clockwisesoftware/rds-ssh-tunnel-docker","last_synced_at":"2026-01-17T13:30:19.280Z","repository":{"id":140710150,"uuid":"531624254","full_name":"ClockwiseSoftware/rds-ssh-tunnel-docker","owner":"ClockwiseSoftware","description":null,"archived":false,"fork":false,"pushed_at":"2022-09-04T09:58:02.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-30T03:26:12.704Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","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/ClockwiseSoftware.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":"2022-09-01T17:39:54.000Z","updated_at":"2022-09-01T17:41:42.000Z","dependencies_parsed_at":"2024-07-16T17:19:15.420Z","dependency_job_id":null,"html_url":"https://github.com/ClockwiseSoftware/rds-ssh-tunnel-docker","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ClockwiseSoftware%2Frds-ssh-tunnel-docker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ClockwiseSoftware%2Frds-ssh-tunnel-docker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ClockwiseSoftware%2Frds-ssh-tunnel-docker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ClockwiseSoftware%2Frds-ssh-tunnel-docker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ClockwiseSoftware","download_url":"https://codeload.github.com/ClockwiseSoftware/rds-ssh-tunnel-docker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239758830,"owners_count":19692034,"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":[],"created_at":"2024-11-08T00:28:23.243Z","updated_at":"2026-01-17T13:30:17.216Z","avatar_url":"https://github.com/ClockwiseSoftware.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"## SSH tunnel docker container for AWS RDS postgres database\n\nThe aim of this repo is to show an example of docker container and docker compose file to provide SSH tunnel to your AWS RDS database.\n\nWith this config you can get a container to connect your aws RDS database.\n\nAlso, container has postgres client installed, and you can do backups or the other maintenance tasks.\n\n\n### Using DEV database proxy\n- You should have ssh key for your bastion server, for example `aws_bastion_rsa` key file in your user `~/.ssh` directory\n- Copy `docker-compose-db-proxy.yml` and set up environment section specific for you:\n  \n  - BASTION_IP - It's usually your dev server IP\n  - BASTION_USER - user to connect bastion server via ssh, usually `ec2-user` for amazon linux\n  - BASTION_SSH_KEY - you ssh key file name `aws_bastion_rsa`\n  - SOURCE_DOMAIN_OR_IP - you RDS postgres server domain\n  - ALIVE_INTERVAL - (default 60) ServerAliveInterval option https://man.openbsd.org/ssh_config.5#ServerAliveInterval\n  - ALIVE_COUNT_MAX - (default 10) ServerAliveCountMax https://man.openbsd.org/ssh_config.5#ServerAliveCountMax\n\nDocker compose sample:\n```yaml\nversion: '3'\nservices:\n  db-proxy:\n    image: ghcr.io/clockwisesoftware/rds-ssh-tunnel-docker:master\n    environment:\n      BASTION_IP: 1.1.1.153\n      BASTION_USER: ec2-user\n      BASTION_SSH_KEY: aws_bastion_rsa\n      SOURCE_DOMAIN_OR_IP: my-postgres-db.us-west-2.rds.amazonaws.com\n      SOURCE_PORT: 5432\n      CONTAINER_PORT: 54324\n    volumes:\n      - ~/.ssh:/home/node/.ssh\n    ports:\n      - '54324:54324'\n```\n\n```shell\ndocker-compose -f docker-compose-db-proxy.yml up\n```\nDatabase should be accessible from your host machine as localhost:54324 and in docker container as db-proxy:54324\n\n\nYou can make a dump of DEV database:\n\nwithout logging to container's shell, just from your local console\n\n```shell\ndocker-compose -f docker-compose-db-proxy.yml exec db-proxy pg_dump -h localhost -p 54324 -U api_dev -f dump.sql databasename_dev\n```\n\nor log into a container shell run pg_dump like below and paste postgres user's password\n\n```shell\ndocker-compose -f docker-compose-db-proxy.yml exec db-proxy bash\npg_dump -h localhost -p 54323 -U postgres -f dump.sql databasename_dev\n```\n\n\n### Bastion keep connection alive config\n\n- Configuring the sshd part on the server.\n\n`/etc/ssh/sshd_config`\n\n```shell\nClientAliveInterval 60\nTCPKeepAlive yes\nClientAliveCountMax 10000\n```\n\n- Restart the ssh server\n\nservice `ssh restart` or  `service sshd restart` depending on what system you are on.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclockwisesoftware%2Frds-ssh-tunnel-docker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclockwisesoftware%2Frds-ssh-tunnel-docker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclockwisesoftware%2Frds-ssh-tunnel-docker/lists"}