Giter Club home page Giter Club logo

gossm's Introduction

gossm

I needed a tool to utilise the ~/.aws/config file to launch a session via AWS Systems Manager to an instance in the cloud.

Written in Go, this tool allows you to launch the aws cli ssm components.

if you do not set an environment variable for the AWS_PROFILE it will interrogate the ones found in ~/.aws/config and provide you a list to pick from before .

Once the profile is set, it will get a list of the EC2 instances.

usage: AWS_PROFILE=<profile_name> gossm

[1]   i-AAAAAAAAAAAAAAAAA    svr1.example.com (1)
[2]   i-BBBBBBBBBBBBBBBBBB   svr2.example.com
[3]   i-CCCCCCCCCCCCCCCCCC   svr3.example.com
Launch number:> 2 (2)
  1. The list of instances to pick from.

  2. The command prompt to enter the number representing the list above.

Once you select the instance, it will launch the session via the command line application, in the following way : aws --profile <AWS_PROFILE> ssm start-session --target <i-BBBBBBBBBBBBBBBBBB>

You can further filter the list by specifying tag values, that will eb checked.

eg gossm prd web will look for machines tagged with both prd and web and present you a list of instances.

Note
It does not check that the SSM agent is running on these instances.

AWS Profiles

Not really in scope for this tool, but I have a list of AWS profiles in ~/.aws/config and the connection credentials are stored in ~/.aws/credentials

see AWS Documentation for more information on the ~/.aws/* files.

Example: ~/.aws/config
[profile SAMPLE-PROFILE] (1)
region = ap-southeast-2 (2)
role_arn = arn:aws:iam::1234567890:role/FullAWSAccess (3)
source_profile = sample-admin-account (4)
  1. Name of the profile, used by gossm.

  2. The region to use for the profile.

  3. The role to use for the profile. This is the role in the account you want to utilise.

  4. The account from the ~/.aws/credentials you want to use.

Example: ~/.aws/credentials
[sample-admin-account]  (1)
aws_access_key_id = ABCD... (2)
aws_secret_access_key = ABCD... (3)
  1. the name you specify for the config, also used for the connection, eg gossm sample-admin-acount

  2. access key from AWS

  3. the secre from AWS

Simple Install

To grab the latest build from github, run the following command.

go install github.com/bovinemagnet/gossm@latest

This will install the latest built version.

Important
Pressing ctrl-Z will suspend the gossm process not the process on the remote

AWS CLI and SSM

Remember to install AWS CLI and AWS SSM before using this tool.

On arch linux, I ran the following:

ArchLinux

Install AWS CLI
sudo pacman -S aws-cli-v2
Install AWS SSM Plugin
git clone https://aur.archlinux.org/aws-session-manager-plugin.git
cd aws-session-manager-plugin
makepkg -sri
Note
Check the steps, to ensure they match your environemnt.

gossm's People

Contributors

bovinemagnet avatar dependabot[bot] avatar

Watchers

 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.