{"id":19541785,"url":"https://github.com/nullscreen/ec2-ssh","last_synced_at":"2025-02-26T05:19:11.969Z","repository":{"id":71532047,"uuid":"100295179","full_name":"nullscreen/ec2-ssh","owner":"nullscreen","description":"SSH to an EC2 instance by Name tag","archived":false,"fork":false,"pushed_at":"2022-09-05T11:21:37.000Z","size":20,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-01-08T18:48:15.253Z","etag":null,"topics":["aws-cli","ec2","ssh"],"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/nullscreen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2017-08-14T17:59:46.000Z","updated_at":"2022-09-05T11:20:30.000Z","dependencies_parsed_at":"2023-02-23T11:30:22.595Z","dependency_job_id":null,"html_url":"https://github.com/nullscreen/ec2-ssh","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/nullscreen%2Fec2-ssh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nullscreen%2Fec2-ssh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nullscreen%2Fec2-ssh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nullscreen%2Fec2-ssh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nullscreen","download_url":"https://codeload.github.com/nullscreen/ec2-ssh/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240795398,"owners_count":19858809,"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-cli","ec2","ssh"],"created_at":"2024-11-11T03:11:56.679Z","updated_at":"2025-02-26T05:19:11.770Z","avatar_url":"https://github.com/nullscreen.png","language":"Shell","readme":"# EC2 SSH\n\n[![CI Status](https://github.com/nullscreen/ec2-ssh/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/nullscreen/ec2-ssh/actions?query=workflow%3ACI+branch%3Amaster)\n\nSSH to an EC2 instance by `Name` tag.\n\n## Installation\n\nFirst install the [AWS CLI][aws-cli]. Then copy or symlink `essh` somewhere on\nyour `PATH`. See `essh -h` for usage information.\n\n[aws-cli]: https://aws.amazon.com/cli/\n\n## Introduction\n\n```sh\nessh [OPTIONS] [SEARCH] [--] [SSH_OPT...]\n```\n\nTo search for an instance by name, type a portion of the name as the first\nargument. The results will be listed in alphabetical order by name.\n\n```sh\n$ essh web\n1) app-production-web    ip-10-0-0-1.ec2.internal\n2) app-production-web    ip-10-0-0-2.ec2.internal\n3) web-bastion           ec2-216-3-128-12.compute-1.amazonaws.com\n\u003e\n```\n\nThen enter the number you want to ssh to. If there is only one result, it will\nbe selected automatically. EC2 SSH will automatically generate the ssh command\nand run it.\n\n```sh\n# If you selected 3 above, essh will automatically run\nssh ec2-216-3-128-12.compute-1.amazonaws.com\n```\n\nYou can also run `essh` with no parameters and it will list all instances.\n\n```sh\n$ essh\n1) app-production-web    ip-10-0-0-1.ec2.internal\n2) app-production-web    ip-10-0-0-2.ec2.internal\n3) app-worker            ip-10-0-0-4.ec2.internal\n4) web-bastion           ec2-216-3-128-12.compute-1.amazonaws.com\n\u003e\n```\n\n## AWS Authentication\n\n`-p profile` Specify an AWS CLI profile\n\nEC2 SSH supports the same authentication types as the AWS CLI. This includes the\n`/.aws/credentials` file, environment variables, and instance profiles. If you\nhave multiple CLI profiles configured, you can specify one with the `-p` flag.\n\n```sh\n$ essh -p prod web\n```\n\nMultiple profiles are allowed if you want to list instances from multiple\naccounts.\n\n```sh\n$ essh -p prod -p dev web\n```\n\n## AWS Regions\n\n- `-r region` Specify an AWS region\n- `-R` Search all regions\n\nIf you don't specify a region, the default AWS CLI region will be used. To\noverride the default, use the `-r` flag. Multiple regions can be specified and\nthe results will be combined. Optionally, use `-R` to search all regions.\n\n```sh\n$ essh -r us-east-1 -r us-west-2 web\n```\n\n## DNS Types\n\n- `-d` Use private DNS name\n- `-D` Use public DNS name\n\nIf an instance has a public DNS name, it will be preferred over the private DNS\nname. If you need to override that default, use the `-d` flag. This forces all\nDNS to private. You might need to do that for instances that have a public IP,\nbut don't allow SSH from the internet.\n\nNote that you'll need to set up your `~/.ssh/config` file to allow SSHing\nthrough a bastion host if you need to access an instance with only private DNS.\n\n## List Operations\n\n- `-c number` Choose a number instead of showing choices\n- `-l` Force showing the list even for only 1 option\n\n## SSH Options\n\n- `-u user` Specify the ssh login user\n- `--` Any options after this will be passed to the SSH command\n\nUsually you will want to configure your username in the `~/.ssh/config` file,\nbut if you need override that, use the `-u` to set your username.\n\n```sh\n$ ssh -u ec2-user web\n```\n\nTo pass other options to SSH, specify them after the search parameter or after\n`--`.\n\n```sh\n# The -- is only required if you don't pass a search parameter.\n$ ssh web -i ~/.ssh/id_rsa\n$ ssh -- -i ~/.ssh/id_rsa\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnullscreen%2Fec2-ssh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnullscreen%2Fec2-ssh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnullscreen%2Fec2-ssh/lists"}