Coder Social home page Coder Social logo

ssm-multi-tmux's Introduction

ssm-multi-tmux

Run an interactive AWS SSM command in synchronised tmux panes on one or more EC2 instances by specifying the autoscaling group name or tag key and value.

Getting Started

These instructions will help you setup the script on your local machine. See usage for further information.

Prerequisites

The following must be installed:

Installing

Clone this repo or download multissm.sh script

git clone [email protected]:elpy1/ssm-multi-tmux.git

Copy the script to a local bin directory

cp ssm-multi-tmux/multissm.sh ~/.local/bin  

Ensure directory is in your PATH

echo "PATH=$HOME/.local/bin${PATH:+:${PATH}}" >> ~/.bashrc

Usage

The script can be used by specifying either an EC2 autoscaling group name or the tag key and tag value of your target instances, as well as the command to run on the remote instances. Ensure AWS environment variables are available via your tool of choice e.g. AWS_PROFILE or AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_SESSION_TOKEN

Usage: multissm.sh [-h] [-t <key>] -v <value> | -a <asg name> [--] <command>  
Try 'multissm.sh --help' for more information.

Examples

Connect to EC2 instances in an autoscaling group

Execute htop on instances in autoscaling group wordpress-prod:

multissm.sh --asg wordpress-prod htop

Tail httpd journal output on instances in autoscaling group drupal-web-asg:

multissm.sh --asg drupal-web-asg -- journalctl -f -u httpd

Connect to EC2 instances with specific tag

Execute bash on instances with a tag key of Name and tag value of prod-internal-cms02:

multissm.sh --tag Name --value prod-internal-cms02 -- bash 

Output date every second on instances with tag key app-server and tag value drupal-frontend:

multissm.sh --tag app-server --value drupal-frontend -- watch -t -n1 date +%s 

Demo

Executing htop on an autoscaling group containing 4 instances multissm demo htop

License

This project is licensed under the MIT License - see the LICENSE file for details

ssm-multi-tmux's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

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.