Giter Site home page Giter Site logo

itsdalmo / ssm-sh Goto Github PK

View Code? Open in Web Editor NEW
145.0 13.0 15.0 1.61 MB

Experiment to use SSM RunCommand instead of SSH

Home Page: https://medium.com/telia-next/ssh-on-aws-there-is-a-service-for-that-21bc01987044

License: MIT License

Go 90.39% Makefile 1.46% HCL 7.64% Dockerfile 0.51%
aws ssm ssh bastion jumpbox golang

ssm-sh's People

Contributors

felixb avatar geowa4 avatar mikael-lindstrom avatar mumoshu avatar

Stargazers

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

Watchers

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

ssm-sh's Issues

Support S3 bucket and key for run/shell output

The stdout and stderr output fetched from the SSM API has a limit on the number of characters, and output which exceeds this limit will be truncated. The way to work around this is to specify OutputS3BucketName and OutputS3KeyPrefix as seen here: https://docs.aws.amazon.com/sdk-for-go/api/service/ssm/#SendCommandInput

The command result (GetCommandInvocationOutput) will then contain a StandardOutputUrl and StandardErrorUrl - links to the full output of the command.

We should add the following flags to run/shell (suggestion/subject to change):

  • --s3-bucket
  • --s3-key

I'm thinking we sometimes might want to store the complete (potentially very long) output, but not display it. Hence, I also think we perhaps need to add a flag to opt into the complete output:

  • --extended-output

Code wise, I think that newCommandOutput could be rewritten to check for the TRUNCATED suffix and instead fetch output from S3 if the extended output is wanted. In those cases, we'd have to make two API calls to get the non-truncated output - but I'm assuming that this is the exception rather than the rule.

Our print function should also be changed to include a link to the full output.

Add support for triggering predefined documents

SSM supports predefining documents containing more complex command. We should add support for listing and running these through ssm-sh.

Suggested syntax

> ssm-sh list-documents # list all available documents in SSM
> ssm-sh run-document --document <document> --target=<instance-id> # runs document for a single instance
> ssm-sh run-document --document <document> --target-file=<file-containing-instance-ids> # runs document for a list of instances

"list instances" does not return instance

Hello,
thank you for the cool tool.

I created EC2 instances in the eu-west-1, and the following command does not see any instances:
./ssm-sh-darwin-amd64 list instances -p default
Instance ID | Name | State | Image ID | Platform | Version | IP | Status | Last pinged

where aws command returns 2 instances:
aws ec2 describe-instances --profile default | gron | grep InstanceId
json.Reservations[0].Instances[0].InstanceId = "i-0ebxxxxd8a2";
json.Reservations[1].Instances[0].InstanceId = "i-0183xxxxf4d1";

Feature: Select targets by tags

We have multiple environments and typically want to operate (e.g. show logs) on all instances within an environment. So it would be useful if shell/run supported something like

ssm-sh run --target-by-tag Env=Production

which would select or eligible EC2 targets that have the tag Env with the value Production.

Does this make sense?

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.