ec2fzf

package module
v0.0.0-...-4bbe3f2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 22, 2020 License: MIT Imports: 14 Imported by: 0

README

ec2-fzf

ec2-fzf is a tool that utilised the fzf fuzzy matcher in order to retrieve the public or private address of an ec2 instance.

GIF

Installation

go get github.com/solarnz/ec2-fzf/cmd/ec2-fzf

Usage

You can pass --private to ec2-fzf, and it will return the private ip address of the instance, rather than the public dns record. This is useful for instances within a VPC.

You can also set --region and pass the ec2 region you would like to list instances in.

You can use ec2-fzf with ssh with ssh $(ec2-fzf --region ap-southeast-2)

You can add filters on to the instances that are listed with the --filters flag. You can define --filters multiple times to filter by more than one value. Valid values are those used in the aws-sdk-go sdk

ec2-fzf --filters tag:realm=test --filters tag:Name=Test

Configuration

You can set the default configuration options in ~/.config/ec2-fzf/config.toml, example

Region = "us-east-1"
Template = "{{index .Tags \"Name\"}}"

Documentation

Index

Constants

View Source
const VERSION = "2.0-dev"

Variables

This section is empty.

Functions

func InstanceIdFromString

func InstanceIdFromString(s string) (string, error)

func TemplateForInstance

func TemplateForInstance(i *ec2.Instance, t *template.Template) (output string, err error)

Types

type Ec2fzf

type Ec2fzf struct {
	// contains filtered or unexported fields
}

func New

func New() (*Ec2fzf, error)

func (*Ec2fzf) GetConnectionDetails

func (e *Ec2fzf) GetConnectionDetails(instance *ec2.Instance) string

func (*Ec2fzf) ListInstances

func (e *Ec2fzf) ListInstances(ec2Client *ec2.EC2) ([]*ec2.Instance, error)

func (*Ec2fzf) Run

func (e *Ec2fzf) Run()

type Options

type Options struct {
	Regions         []string
	UsePrivateIp    bool
	Template        string
	PreviewTemplate string
	Filters         []string
}

func ParseOptions

func ParseOptions() Options

type Tags

type Tags []*ec2.Tag

func (Tags) Len

func (s Tags) Len() int

func (Tags) Less

func (s Tags) Less(i, j int) bool

func (Tags) Swap

func (s Tags) Swap(i, j int)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL