Home

Awesome

gossm

gossm is interactive CLI tool that you should select server in AWS and then could connect or send files your AWS server using start-session, ssh, scp under AWS Systems Manger Session Manager.

<p align="center"> <img src="https://storage.googleapis.com/gjbae1212-asset/gossm/start.gif" width="500", height="450" /> </p> <p align="center"/> <a href="https://circleci.com/gh/gjbae1212/gossm"><img src="https://circleci.com/gh/gjbae1212/gossm.svg?style=svg"></a> <a href="https://hits.seeyoufarm.com"/><img src="https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Fgjbae1212%2Fgossm"/></a> <a href="/LICENSE"><img src="https://img.shields.io/badge/license-MIT-GREEN.svg" alt="license" /></a> <a href="https://goreportcard.com/report/github.com/gjbae1212/gossm"><img src="https://goreportcard.com/badge/github.com/gjbae1212/gossm" alt="Go Report Card"/></a> </p>

Overview

gossm is interactive CLI tool that is related AWS Systems Manger Session Manager. It can select a ec2 server installed aws-ssm-agent and then can connect its server using start-session, ssh. As well as files can send using scp.
If you will use gossm tool, this mean there will no need to open inbound 22 port in your ec2 server when is using ssh or scp command.
Because AWS Systems Manger Session Manager is using ssh protocol tunneling.
<br/> Additionally Features

Prerequisite

ec2

user

Install

Homebrew

# install
$ brew tap gjbae1212/gossm
$ brew install gossm

# upgrade
$ brew upgrade gossm

Download

download

How to use

global command args

argsDescriptionDefault
-c(optional) aws credentials file$HOME/.aws/credentials
-p(optional) if you are having multiple aws profiles in credentials, it is name one of profilesdefault
-r(optional) region in AWS that would like to connect

If your machine don't exist $HOME/.aws/.credentials, have to pass -c args.

# credentials file format
[default]
aws_access_key_id = AWS ACCESS KEY
aws_secret_access_key = AWS SECRET KEY

-r or -t don't pass args, it can select through interactive CLI.

command

start

$ gossm start 

ssh, scp

-e must pass args when is using scp.
-e args is command and args when usually used to pass ssh or scp.

# ssh(if pem is already registered using ssh-add)
$ gossm ssh -e 'user@server-domain'

# ssh(if pem isn't registered)
$ gossm ssh -e '-i key.pem user@server-domain'

# ssh(if pem is already registered using ssh-add and don't pass -e option) -> select server using interactive cli
$ gossm ssh

# ssh(if pem isn't registered and don't pass -e option) -> select server using interactive cli
$ gossm ssh -i key.pem
 
# scp(if pem is already registered using ssh-add)
$ gossm scp -e 'file user@server-domain:/home/blahblah'

# scp(if pem isn't registered)
$ gossm scp -e '-i key.pem file user@server-domain:/home/blahblah'

ex)

<p align="center"> <img src="https://storage.googleapis.com/gjbae1212-asset/gossm/ssh.gif" width="500", height="450" /> </p>

cmd

-e required args, it is a parameter for execute to command on selected servers.

# It is to execute a command("uptime") on selected multiple servers, waiting for a response on its result.
$ gossm cmd -e "uptime" 

fwd

-z Optionally specify the remote port to access -l Optionally specify the local port to forward (If not specified when using -z, then this value defaults to the value of -z)

$ gossm fwd -z 8080 -l 42069

If not specified, you will be prompted to enter a remote and local port after selecting a target.

mfa

-deadline it's to set expire time for temporary credentials. default is 6 hours.
-device it's to set mfa device. default is your virtual mfa device.

$ gossm mfa <your-mfa-code>

Must set to export AWS_SHARED_CREDENTIALS_FILE=$HOME/.aws/credentials_mfa in .bash_profile, .zshrc.

ex)

<p align="center"> <img src="https://storage.googleapis.com/gjbae1212-asset/gossm/mfa.png" /> </p>

LICENSE

This project is following The MIT.