itsdalmo / ssm-sh Goto Github PK
View Code? Open in Web Editor NEWExperiment 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
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
Forgot this when merging #12 - need to update README.md with the actual output from --help
, which now includes new flags for SSM for the run
and shell
commands.
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.
Need to figure out if we can access the github tag in the build set for the docker image, so they binary has a version instead of a git ref when doing --version
.
Basically it returns the list of ec2 instances only. But you can run ssm agent on onprem(ManagedInstance) too.
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
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";
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?
I saw your repository of SSM-SH https://github.com/itsdalmo/ssm-sh
first of all .... amazing!
second I was working exactly on the same project only using python
https://github.com/giuliocalzolari/sshless
I was thinking if maybe we can do the same tool with the same functionality only written in two languages
What do you think about it?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.