• Stars
    star
    416
  • Rank 104,068 (Top 3 %)
  • Language
    Go
  • License
    MIT License
  • Created over 5 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

💻Interactive CLI tool that you can connect to ec2 using commands same as start-session, ssh in AWS SSM Session Manager

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.

license Go Report Card

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.

Additionally Features

  • mfa command has added. this command is to authenticate through AWS MFA, and then to save issued a temporary credentials in $HOME/.aws/credentials_mfa. (default expired time is after 6 hours)
    You should export global environment, such as export AWS_SHARED_CREDENTIALS_FILE=$HOME/.aws/credentials_mfa.
    With completed, you can execute AWS CLI and gossm conveniently without mfa authenticated.
    Refer to detail information below.

Prerequisite

ec2

  • [required] Your ec2 servers in aws are installed aws ssm agent.
  • [required] ec2 severs have to attach AmazonSSMManagedInstanceCore iam policy.
  • If you would like to use ssh, scp command using gossm, aws ssm agent version 2.3.672.0 or later is installed on ec2.

user

  • [required] your aws access key, aws secret key
  • [required] ec2:DescribeInstances, ssm:StartSession, ssm:TerminateSession, ssm:DescribeSessions, ssm:DescribeInstanceInformation, ssm:DescribeInstanceProperties, ssm:GetConnectionStatus
  • [optional] It's better to possibly get to additional permission for ec2:DescribeRegions

Install

Homebrew

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

# upgrade
$ brew upgrade gossm

Download

download

How to use

global command args

args Description Default
-c (optional) aws credentials file $HOME/.aws/credentials
-p (optional) if you are having multiple aws profiles in credentials, it is name one of profiles default
-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)

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)

LICENSE

This project is following The MIT.

More Repositories

1

hit-counter

🚀 Easy way to know how many visitors are viewing your Github, Website, Notion. 🎉
Go
1,014
star
2

findgs

FindGS is an interactive CLI that searches from README, NAME, TOPICS for wanted starred repositories quickly.🔥
Go
76
star
3

grpc-vpn

🍄 VPN supporting authentication such as Google OpenID Connect or AWS IAM ..., over GRPC. :shipit:
Go
60
star
4

kubectl-cred

kubectl-cred is a kubernetes plugin to which switch to contexts and namespaces and clusters using an interactive CLI.
Go
13
star
5

go-esworker

Async Worker that bulk insert, update, delete to ElasticSearch for Golang. 🚀
Go
9
star
6

cloud-instance-dns

🔎 A DNS that look up your aws(ec2), gcp(compute-engine) regardless of multi regions by instance-name or id.🌸
Go
6
star
7

fluent-bit-pubsub

FluentBit output plugin for google pubsub.
Go
6
star
8

fluent-bit-consul

FluentBit output plugin for consul.
Go
5
star
9

go-module

Go library and useful utilty.
Go
5
star
10

go-grpcpool

go-gprcpool is a pool for GRPC connections.
Go
4
star
11

go-bqworker

go-esworker is an async worker that data can bulk insert, update to the BigQuery.
Go
3
star
12

go-counter-badge

go-counter-badge can create Badges formatted SVG.
Go
3
star
13

go-apachebeam-gzipio

To transform for reading and writing gzip files in apache beam using Golang.
Go
3
star
14

k8s-letsencrypt

Add, Update wildcard SSL with let's encrypt in GCP
Shell
2
star
15

opentracing-go-redis

Opentracing hook for go-redis v7.
Go
2
star
16

go-async-task

go-async-task is a worker which processes tasks(jobs) asynchronously.
Go
2
star
17

go-wraperror

WrapError is a custom error struct implemented error interface, supporting As, Is, Unwrap.
Go
2
star
18

go-sql

This project is a db connector for SQL databases. And so support to trace context like opentracing.
Go
2
star
19

go-ec2meta

This Library is to get metadata for EC2 Instances using Golang.
Go
1
star
20

opentracing-gorm

This project is a opentracing wrapper for gorm.
Go
1
star
21

go-relogger

It is a logger that supports to reopen logging file when traps signal or is passed a time interval.
Go
1
star
22

go-limiter

Go-Limiter is a rate limiter which can throttle up and back requests in a specified situation.
Go
1
star
23

prometheus-hystrix-go

prometheus collector for hystrix-go.
Go
1
star
24

go-geoip2

This project can search for IP information through Maxmind geoip2 databases. It supports to be automatically downloaded and updated the latest Maxmind databases in background.
Go
1
star