|
| 1 | +# NAME |
| 2 | + |
| 3 | +ec2ssh - SSH to Amazon EC2 instances via tag name |
| 4 | + |
| 5 | +# SYNOPSIS |
| 6 | + |
| 7 | +ec2ssh \[OPTIONS\] instance-name \[SSH-OPTIONS\] |
| 8 | + |
| 9 | + Options: |
| 10 | + -? --help Display this help and exits. |
| 11 | + -d --debug Turn on debug logging. |
| 12 | + --list Return a list of matching instances. |
| 13 | + --profile Use a specific profile from your aws credential file. |
| 14 | + --region The region to use, overrides config/env settings. |
| 15 | + --filters A list of filters used to match properties for instances. For a complete reference to the available filter keys for this operation, see the Amazon EC2 API reference. |
| 16 | + --private Force ssh to connect using the private dns name. |
| 17 | + |
| 18 | + SSH-Options |
| 19 | + |
| 20 | + All ssh options are supported provided they are passed in *AFTER* the instance-name. |
| 21 | + |
| 22 | + Examples: |
| 23 | + # SSH to EC2 instance whose name is bowker-imageweb |
| 24 | + ec2ssh bowker-imageweb |
| 25 | + |
| 26 | + # SSH to ec2 instance using an identity file |
| 27 | + ec2ssh bowker-imageweb -i /path/to/identity-file |
| 28 | + |
| 29 | + # SSH to ec2 instance as a specific 'user' |
| 30 | + ec2ssh user@bowker-imageweb |
| 31 | + |
| 32 | + # List all ec2 instances associated with the default profile |
| 33 | + ec2ssh --list |
| 34 | + |
| 35 | + # List all ec2 instances that start with the tag name 'bowker' |
| 36 | + ec2ssh --list bowker* |
| 37 | + |
| 38 | + # SSH to ec2 instance named bowker-imageweb in a different region |
| 39 | + ec2ssh --region us-west-2 bowker-imageweb |
| 40 | + |
| 41 | + # SSH to ec2 instance and execute command 'whoami' |
| 42 | + ec2ssh bowker-imageweb whoami |
| 43 | + |
| 44 | + # SSH to ec2 instance that is part of a specific profile (non-default) |
| 45 | + ec2ssh --profile pqis bowker-imageweb |
| 46 | + |
| 47 | + # SSH to ec2 instance using it's private DNS name |
| 48 | + ec2ssh --private bowker-imageweb |
| 49 | + |
| 50 | +# DESCRIPTION |
| 51 | + |
| 52 | +Open an ssh connection to an EC2 instance where <instance-name> equals |
| 53 | +tag:value. The 'tag:' portion of <instance-name> is optional, and defaults to |
| 54 | +'Name'. A list of instances will be returned when using the --list parameter |
| 55 | +or if more then one matching instance is found. |
| 56 | + |
| 57 | +All ssh options are supported as long as they are passed in \*AFTER\* the |
| 58 | +<instance-name>. |
| 59 | + |
| 60 | +Please note, this command wraps the AWS Command Line Interface tool which must |
| 61 | +be installed and configured (http://aws.amazon.com/cli/) prior to it's use. |
| 62 | +Please follow these instructions to install the AWS CLI: |
| 63 | + |
| 64 | + # Install AWS CLI |
| 65 | + $ sudo pip install awscli |
| 66 | + |
| 67 | + # Configure AWS CLI 'default' profile |
| 68 | + $ aws configure |
| 69 | + |
| 70 | + # Additional profiles can be configured as follows |
| 71 | + $ aws configure --profile <profile-name> |
| 72 | + |
| 73 | +# AUTHOR |
| 74 | + |
| 75 | +Peter Williams |
| 76 | + |
| 77 | +# LICENSE |
0 commit comments