Skip to content
This repository has been archived by the owner on Oct 11, 2021. It is now read-only.

kenju/go-awssh

Repository files navigation

go-awssh

Go Reference ci-test

go-awssh is a developer tool to make your SSH to AWS EC2 instances easy.

Describing Instances/VPCs data, select one or multiple instances, and make connection(s) to selected instances. Caching the response of API calls for 1day using Tmpfs.

Requirements

Usage

Usage of go-awssh:
  -purge-cache
        purge local cache of AWS API calls
  -region string
        AWS Region for the session (default "us-east-1")
  -ssh-bin string
        a path to the binary for SSH (default "ssh")
  -template-fqdn string
        a template for building FQDN for servers based on text/template interface (default "{{.Name}}.aws.example.com")

Examples

Example A

Connect <instance_id>.aws.yourdomain.com via ssh command by retrieving AWS EC2 Instance/VPC data from us-east-1 region:

/path/to/go-awssh \
    -region us-east-1 \
    -ssh-bin ssh \
    -template-fqdn "{{.InstanceId}}.aws.yourdomain.com"

Example B

Connect <instance_id>.aws.yourdomain.com via cssh command by retrieving AWS EC2 Instance/VPC data from ap-northeast-1 region:

/path/to/go-awssh \
    -region ap-northeast-1 \
    -ssh-bin cssh \
    -template-fqdn "{{.InstanceId}}.aws.yourdomain.com"

Pro Tips

Accessing multiple servers

You can make use of cssh(1) and SSH to multiple servers at the same time. Once you install cssh, pass -ssh-bin as follows:

/path/to/go-awssh \
    -region ap-northeast-1 \
    -ssh-bin cssh \
    -template-fqdn "{{.InstanceId}}.aws.yourdomain.com"

peco allows you to select multiple lines by StickySelection feature.

peco.ToggleSelectionAndSelectNext allows you to select the current line, saves it, and proceeds to the next line.

{
    "Keymap": {
        "C-t": "peco.ToggleSelectionAndSelectNext"
    },
    "StickySelection": true
}

Development

Unit Tests

Run make test locally.

GitHub Actions runs when commits pushed.

Release

git tag and push to the master branch.

goreleaser is triggered via GitHub Actions.