GithubHelp home page GithubHelp logo

robertpeteuil / aws-shortcuts Goto Github PK

View Code? Open in Web Editor NEW
14.0 3.0 1.0 238 KB

Shortcuts for AWS EC2 Instance Control from the command-line: list, start, stop and ssh

License: GNU General Public License v3.0

Python 100.00%
aws aws-ec2 aws-ssh aws-cli-utilities aws-console ec2-instance aws-shell aws-manage python-tests pytest code-coverage travis-ci appveyor-ci cicd-pipeline tox pypi-package

aws-shortcuts's Introduction

AWS CLI Shortcuts - Simplified Instance Management

Easily List, Control and Connect to Instances directly from the Shell

Travis AppVeyor Codacy Grade Codecov Cov PyPi release lang


Identify, control and connect-to instances directly from the command line with AWSS. It requires no parameters and allows the use of wildcards when specifying instances, making it ideal when minimal instance details are known or multiple instances match known parameters. In these scenarios, a pick-list is displayed of instances that match the command and parameters specified.

This enables easy identification and selection of desired target instances, and eliminates the need to leave the shell to retrieve information from the Web Portal - preventing workflow disruption and retaining your focus.

AWSS is extremely useful in many scenarios, including:

  • Connecting to on-demand instances that frequently change state, and thus IP address as well.
  • Connecting to instances where the required login-user is unknown.
  • Connecting to instances where the required key associated with the login-user is unknown.
  • Connecting to instances where the instance-id is unknown.
  • Connecting to instances where 'name' is not set or unique.

Screenshots

"awss ssh" without any parameters - allowing selection from a list of possible 'ssh' targets

https://cloud.githubusercontent.com/assets/1554603/26036941/363b9bf2-389d-11e7-88ab-3ab0e1d52f30.jpg

"awss list" - presents a list of all instances, details and all tags

https://cloud.githubusercontent.com/assets/1554603/25595372/6c3bd5e2-2e79-11e7-9ebc-4730f93c2cb6.png

"awss start" with partial Name and wildcard supplied - allowing selection from a list of possible targets

https://cloud.githubusercontent.com/assets/1554603/25595396/84b4ef64-2e79-11e7-922f-d645b007af57.png

Tested Platforms & Python Versions

Python 2.7, 3.4, 3.5, 3.6

Platforms:

Installation

This utility can be installed with pip:

pip install awss

Windows Prereqs

Windows does not have a built-in ssh command, so using the awss ssh command on windows requires:

  • Installation of PuTTY Suite
    • use the "Windows Installer", install all options, and include it on your path
  • Converting ssh keys from Amazon's ".pem" format to ".ppk" format
  • Powershell (native in of Windows since Windows XP Service Pack 3)

Configuration

SSH Access Keys (.pem or .ppk files)

  • Keys should be stored in the .aws folder in your home directory
  • Unix-type systems must set permission on files with a command such as sudo chmod 400 ~/.aws/*.pem
  • Windows systems must convert files to ".ppk" format, as described in Windows Prereqs

AWS Credentials can be stored using either one of these two methods:

  • Environment variables "AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY" and "AWS_DEFAULT_REGION"

  • Files named "credentials" and "config" in the .aws folder in your home directory

    • The Windows home directory is referred to by the environment variable %UserProfile%

    {HOME}/.aws/credentials

    [default]
    aws_access_key_id=AKIAIOSFODNN7EXAMPLE
    aws_secret_access_key=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY

    {HOME}/.aws/config

    [default]
    region=us-west-2
    output=json
  • Information on AWS Credentials is in the AWS Getting Setup guide.

  • Information on configuration files in is the AWS Getting Started guide.

Command Details

  • SSH to Instance: awss ssh, awss ssh NAME or awss ssh -i ID
    • typing awss ssh without a name or ID will display all running instances
      • this allows the user to select from the list if they can't remember the name
      • this can be combined with wilcards, for example awss ssh U* to display a list of instances starting with "U" to select from
    • the login-name is automatically calculated based on the image-type of the instance
    • override the calculated login-name -u USERNAME
    • connect without PEM keys (if properly configured) -p
    • command specific help awss ssh -h
  • List Instances: awss list (other variations listed below)
    • list all instances (default), or use wilcards awss list D*
    • list running instances -r or --running
    • list stopped instances -s or --stopped
    • list instances with specified name awss list NAME
    • list instance with specified instance-id awss list -i ID
    • instance-state and NAME may be combined in queries
      • ex: list instances with NAME currently running: awss list NAME -r
    • command specific help awss list -h
  • Start Instance: awss start, awss start NAME or awss start -i ID
    • typing awss start without a name or ID will display all stopped instances
      • this allows the user to select from the list if they can't remember the name
      • this can be combined with wilcards, for example awss start U* to display a list of instances starting with "U" to select from
    • start instance by name or instance-id
    • command specific help awss start -h
  • Stop Instance: awss stop, awss stop NAME or awss stop -i ID
    • typing awss stop without a name or ID will display all running instances
      • this allows the user to select from the list if they can't remember the name.
      • this can be combined with wilcards, for example awss stop U* to display a list of instances starting with "U" to select from.
    • start instance by name or instance-id
    • command specific help awss stop -h

aws-shortcuts's People

Contributors

robertpeteuil avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

lukeenterprise

aws-shortcuts's Issues

Pics for README

List - 430
awss_list

Picklist - 430
picklist-after1

List - 575
awss_list_c-575

Picklist - 575
picklist-after-575

SSH Picklist - 575
ssh-picklist-575

Initial Update

The bot created this issue to inform you that pyup.io has been set up on this repo.
Once you have closed it, the bot will open pull requests for updates as soon as they are available.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.