{"id":20820530,"url":"https://github.com/frederikp/sshaws","last_synced_at":"2025-05-07T15:43:41.556Z","repository":{"id":54170578,"uuid":"210625160","full_name":"FrederikP/sshaws","owner":"FrederikP","description":"Simply connect to your 'EC2 Instance Connect'-capable AWS EC2 servers using one command","archived":false,"fork":false,"pushed_at":"2021-03-05T16:59:40.000Z","size":75,"stargazers_count":52,"open_issues_count":2,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-09-30T09:18:52.327Z","etag":null,"topics":["aws","cloud","developer-tools","ec2","pypi","ssh"],"latest_commit_sha":null,"homepage":null,"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/FrederikP.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-09-24T14:36:43.000Z","updated_at":"2022-09-28T09:10:33.000Z","dependencies_parsed_at":"2022-08-13T08:11:00.070Z","dependency_job_id":null,"html_url":"https://github.com/FrederikP/sshaws","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FrederikP%2Fsshaws","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FrederikP%2Fsshaws/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FrederikP%2Fsshaws/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FrederikP%2Fsshaws/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FrederikP","download_url":"https://codeload.github.com/FrederikP/sshaws/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225096696,"owners_count":17420293,"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","cloud","developer-tools","ec2","pypi","ssh"],"created_at":"2024-11-17T22:09:29.564Z","updated_at":"2024-11-17T22:09:30.217Z","avatar_url":"https://github.com/FrederikP.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![PyPi Version](https://img.shields.io/pypi/v/sshaws.svg)](https://pypi.python.org/pypi/sshaws)\n[![PyPi License](https://img.shields.io/pypi/l/sshaws.svg)](https://pypi.python.org/pypi/sshaws)\n[![PyPi Versions](https://img.shields.io/pypi/pyversions/sshaws.svg)](https://pypi.python.org/pypi/sshaws)\n[![PyPi Wheel](https://img.shields.io/pypi/wheel/sshaws.svg)](https://pypi.python.org/pypi/sshaws)\n\n# sshaws\n\nSimply connect to your 'EC2 Instance Connect'-capable AWS EC2 servers using one command.\nIf you use 'EC2 Instance Connect' as described [in this article](https://aws.amazon.com/blogs/compute/new-using-amazon-ec2-instance-connect-for-ssh-access-to-your-ec2-instances/) you already noticed that it can become a hassle to connect to instances, especially if you frequently connect to different instances. The `sshaws` command allows takes care of gathering the necessary information, calling ec2-instance-connect (to register your public key) and, finally, ssh to the instance.\n\nWith sshaws, in the best case, connecting to your instances will look like this:\n\n![](sshaws.gif)\n\nSupport for [SSH connections through AWS Session Manager](https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-getting-started-enable-ssh-connections.html) is also included. This allows you to connect to EC2 instances without Internet access (provided there's a VPC endpoint available) or whose security group does no allow ingress on port 22.\n\n## Requirements\n\n- python3 and pip\n- configured aws credentials and rights to connect to the instance\n- instance needs to support ec2-instance-connect (AWS AMIs support that + you can install it on your servers)\n- public (or private) IP needs to be reachable\n\nChanges to requirements if using SSM tunnel:\n\n- credentials with rights to call `aws ssm start-session` on ressource *document/AWS-StartSSHSession*\n- instance needs to be running the SSM Agent version 2.3.672.0 or later (inc. an appropriate IAM role)\n- instance needs to be reachable through Internet or an SSM VPC endpoint\n\n## Installation\n\n```bash\npip install sshaws\n```\n\nYou might need to use pip3 if you are not in a virtualenv. You might want to install the package in user space (if you don't have sudo rights). E.g.:\n\n```bash\npip3 install --user sshaws\n```\n\n## Usage\n\n```bash\nsshaws \u003cinstance-id\u003e\n```\n\n`\u003cinstance-id\u003e` should be replaced by something like: `i-074126021e7b3e7f5`. The Instance ID can be found in the AWS Console (EC2 view, ECS task description, etc.)\nYou can also use an alias for `\u003cinstance-id\u003e` if aliases are configured in .sshaws.conf. (see Config section)\n\nBy default it will use the default region, your ssh key at ~/.ssh/id_rsa (private) and ~/.ssh/id_rsa.pub (public) and ec2-user as the username used to connect.\nSee the help output to see how to change these options:\n\n```bash\nsshaws --help\n```\n\n## More Examples\n\nTo look for the instance in two different regions use:\n\n```bash\nsshaws \u003cinstance-id\u003e --regions eu-central-1 us-east-1\n```\n\n## Config\n\nTo avoid having to set command line arguments again and again you can write a config file to `~/.sshaws.conf`.\n\nThis is an example:\n\n```json\n{\n    \"os_user\": \"kevin\",\n    \"use_private_ip\": true,\n    \"use_ssm\": false,\n    \"regions\": [\"eu-central-1\", \"us-east-1\"],\n    \"key_file_path_private\": \"/home/example/.ssh/somekey\",\n    \"key_file_path_public\": \"/home/example/.ssh/somekey.pub\",\n    \"forward_agent\": true,\n    \"aliases\": {\n        \"my-ec2-bastion\": \"i-074126021e7b3e7f5\",\n        \"my-web-server\": \"i-004cb95e71985a510\"\n    }\n}\n```\n\nPrivate and public key might be combined in the same file in some cases. Just specify both options with the same value.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrederikp%2Fsshaws","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffrederikp%2Fsshaws","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrederikp%2Fsshaws/lists"}