{"id":13819989,"url":"https://github.com/itsdalmo/ssm-sh","last_synced_at":"2025-04-14T19:36:34.263Z","repository":{"id":57494148,"uuid":"119507141","full_name":"itsdalmo/ssm-sh","owner":"itsdalmo","description":"Experiment to use SSM RunCommand instead of SSH","archived":false,"fork":false,"pushed_at":"2019-12-08T21:15:20.000Z","size":1653,"stargazers_count":145,"open_issues_count":1,"forks_count":14,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-03-28T08:01:44.307Z","etag":null,"topics":["aws","bastion","golang","jumpbox","ssh","ssm"],"latest_commit_sha":null,"homepage":"https://medium.com/telia-next/ssh-on-aws-there-is-a-service-for-that-21bc01987044","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/itsdalmo.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":"2018-01-30T08:39:48.000Z","updated_at":"2025-02-28T09:08:53.000Z","dependencies_parsed_at":"2022-09-12T06:31:13.244Z","dependency_job_id":null,"html_url":"https://github.com/itsdalmo/ssm-sh","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsdalmo%2Fssm-sh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsdalmo%2Fssm-sh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsdalmo%2Fssm-sh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsdalmo%2Fssm-sh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/itsdalmo","download_url":"https://codeload.github.com/itsdalmo/ssm-sh/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248946878,"owners_count":21187588,"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","bastion","golang","jumpbox","ssh","ssm"],"created_at":"2024-08-04T08:00:56.489Z","updated_at":"2025-04-14T19:36:34.242Z","avatar_url":"https://github.com/itsdalmo.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"## SSM shell\n\n[![Build Status](https://travis-ci.org/itsdalmo/ssm-sh.svg?branch=master)](https://travis-ci.org/itsdalmo/ssm-sh)\n\nLittle experiment to mimic SSH by using SSM agent to send commands to\nremote instances and fetching the output.\n\n## Install\n\nGrab a binary from the [releases](https://github.com/itsdalmo/ssm-sh/releases).\n\n#### Docker\n\nThere is also a docker image [here](https://hub.docker.com/r/itsdalmo/ssm-sh/).\n\n#### Manual install\n\nHave Go installed:\n\n```bash\n$ which go\n/usr/local/bin/go\n\n$ echo $GOPATH\n/Users/dalmo/go\n\n$ echo $PATH\n# Make sure $GOPATH/bin is in your PATH.\n```\n\nGet the repository:\n\n```bash\ngo get -u github.com/itsdalmo/ssm-sh\n```\n\nIf everything was successful, you should have a shiny new binary:\n\n```bash\nwhich ssm-sh\n# Should point to $GOPATH/bin/ssm-sh\n```\n\n## Usage\n\n```bash\n$ ssm-sh --help\n\nUsage:\n  ssm-sh [OPTIONS] \u003ccommand\u003e\n\nApplication Options:\n  -v, --version  Print the version and exit.\n\nAWS Options:\n  -p, --profile= AWS Profile to use. (If you are not using Vaulted).\n  -r, --region=  Region to target. (default: eu-west-1)\n\nHelp Options:\n  -h, --help     Show this help message\n\nAvailable commands:\n  describe  Description a document from ssm.\n  list      List managed instances or documents. (aliases: ls)\n  run       Run a command or document on the targeted instances.\n  shell     Start an interactive shell. (aliases: sh)\n```\n\n#### List instances usage\n\n```bash\n$ ssm-sh list instances --help\n\n...\n[instances command options]\n      -f, --filter= Filter the produced list by tag (key=value,..)\n      -l, --limit=  Limit the number of instances printed (default: 50)\n      -o, --output= Path to a file where the list of instances will be written as JSON.\n```\n\n#### List documents usage\n```bash\n$ ssm-sh list documents --help\n\n...\n[documents command options]\n      -f, --filter= Filter the produced list by property (Name, Owner, DocumentType, PlatformTypes)\n      -l, --limit=  Limit the number of instances printed (default: 50)\n```\n\n#### Run cmd/shell usage\n\n```bash\n$ ssm-sh run cmd --help\n\n...\n[cmd command options]\n      -i, --timeout=       Seconds to wait for command result before timing out. (default: 30)\n      -t, --target=        One or more instance ids to target\n          --target-file=   Path to a JSON file containing a list of targets.\n\n    SSM options:\n      -x, --extend-output  Extend truncated command outputs by fetching S3 objects containing full ones\n      -b, --s3-bucket=     S3 bucket in which S3 objects containing full command outputs are stored. Required when --extend-output is provided.\n      -k, --s3-key-prefix= Key prefix of S3 objects containing full command outputs.\n```\n\n#### Run document usage\n\n```bash\n$ ssm-sh run document --help\n\n...\n[document command options]\n      -n, --name=          Name of document in ssm.\n      -i, --timeout=       Seconds to wait for command result before timing out. (default: 30)\n      -p, --parameter=     Zero or more parameters for the document (name:value)\n      -t, --target=        One or more instance ids to target\n          --target-file=   Path to a JSON file containing a list of targets.\n\n    SSM options:\n      -x, --extend-output  Extend truncated command outputs by fetching S3 objects containing full ones\n      -b, --s3-bucket=     S3 bucket in which S3 objects containing full command outputs are stored. Required when --extend-output is provided.\n      -k, --s3-key-prefix= Key prefix of S3 objects containing full command outputs.\n```\n\n## Example\n\n```bash\n$ vaulted -n lab-admin -- ssm-sh list instances --filter Name=\"*itsdalmo\" -o example.json\n\nInstance ID         | Name                             | State   | Image ID     | Platform     | Version | IP            | Status | Last pinged\ni-03762678c45546813 | ssm-manager-manual-test-itsdalmo | running | ami-db1688a2 | Amazon Linux | 2.0     | 172.53.17.163 | Online | 2018-02-09 12:37\ni-0d04464ff18b5db7d | ssm-manager-manual-test-itsdalmo | running | ami-db1688a2 | Amazon Linux | 2.0     | 172.53.20.172 | Online | 2018-02-09 12:39\n\n$ vaulted -n lab-admin -- ssm-sh shell --target-file example.json\nInitialized with targets: [i-03762678c45546813 i-0d04464ff18b5db7d]\nType 'exit' to exit. Use ctrl-c to abort running commands.\n\n$ ps aux | grep agent\ni-03762678c45546813 - Success:\nroot      3261  0.0  1.9 243560 19668 ?        Ssl  Jan27   4:29 /usr/bin/amazon-ssm-agent\nroot      9058  0.0  0.0   9152   936 ?        S    15:02   0:00 grep agent\n\ni-0d04464ff18b5db7d - Success:\nroot      3245  0.0  1.9 317292 19876 ?        Ssl  Feb05   0:27 /usr/bin/amazon-ssm-agent\nroot      4893  0.0  0.0   9152   924 ?        S    15:02   0:00 grep agent\n\n$ echo $HOSTNAME\ni-03762678c45546813 - Success:\nip-172-53-17-163.eu-west-1.compute.internal\n\ni-0d04464ff18b5db7d - Success:\nip-172-53-20-172.eu-west-1.compute.internal\n```\n\n#### Note\n\nIf you don't see any instances listed and still want to test `ssm-sh`,\nyou can see the [terraform/README.md](./terraform/README.md) for a quick\nway of setting up some test instances.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitsdalmo%2Fssm-sh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitsdalmo%2Fssm-sh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitsdalmo%2Fssm-sh/lists"}