All Projects → goldeneggg → Lsec2

goldeneggg / Lsec2

Licence: mit
List view of AWS EC2 instances

Programming Languages

go
31211 projects - #10 most used programming language

Labels

Projects that are alternatives of or similar to Lsec2

kubernetes-ami
A simple AMI and CloudFormation for launching Kubernetes on AWS
Stars: ✭ 41 (+86.36%)
Mutual labels:  aws-ec2
docker-parse-mongo
Parse Server with MongoDB ReplicaSet using Docker (for AWS EC2 or GCP GCE)
Stars: ✭ 27 (+22.73%)
Mutual labels:  aws-ec2
Sis
Simple image search engine
Stars: ✭ 438 (+1890.91%)
Mutual labels:  aws-ec2
CloudRemoting
CloudRemoting PowerShell module - an easier way to PSRemoting, RDP and SSM Run Commands.
Stars: ✭ 18 (-18.18%)
Mutual labels:  aws-ec2
cloud-cheat-sheets
My handmade cheat-sheets for different AWS services.
Stars: ✭ 63 (+186.36%)
Mutual labels:  aws-ec2
Eksctl
The official CLI for Amazon EKS
Stars: ✭ 3,550 (+16036.36%)
Mutual labels:  aws-ec2
polynimbus
Multi-cloud infrastructure inventory and management tool, supporting AWS, Google Cloud, Azure, Oracle Cloud, Rackspace Cloud, Hetzner Cloud, Alibaba Cloud, e24cloud.com, Linode, Cloudflare, GoDaddy and Backblaze B2.
Stars: ✭ 70 (+218.18%)
Mutual labels:  aws-ec2
Aws Node Termination Handler
Gracefully handle EC2 instance shutdown within Kubernetes
Stars: ✭ 757 (+3340.91%)
Mutual labels:  aws-ec2
aws-terraform
AWS & Terraform Rocket Start Guide
Stars: ✭ 53 (+140.91%)
Mutual labels:  aws-ec2
Ansible Playbooks
Ansible playbook collection that have been written for Ubuntu. Some of the playbooks are Elasticsearch, Mesos, AWS, MySql, Sensu, Nginx etc..
Stars: ✭ 429 (+1850%)
Mutual labels:  aws-ec2
goship
Utility that helps find, connect and copy to particular cloud resources using configured providers
Stars: ✭ 18 (-18.18%)
Mutual labels:  aws-ec2
trackit
Trackit helps you understand and improve your use of AWS
Stars: ✭ 91 (+313.64%)
Mutual labels:  aws-ec2
Terraform Aws Ec2 Instance
Terraform module which creates EC2 instance(s) on AWS
Stars: ✭ 344 (+1463.64%)
Mutual labels:  aws-ec2
img ai app boilerplate
An image classification app boilerplate to serve your deep learning models asap!
Stars: ✭ 27 (+22.73%)
Mutual labels:  aws-ec2
Security monkey
Security Monkey monitors AWS, GCP, OpenStack, and GitHub orgs for assets and their changes over time.
Stars: ✭ 4,244 (+19190.91%)
Mutual labels:  aws-ec2
mern-app
Basic MERN app template for AWS EC2 Deployment guide
Stars: ✭ 30 (+36.36%)
Mutual labels:  aws-ec2
Spark Jupyter Aws
A guide on how to set up Jupyter with Pyspark painlessly on AWS EC2 clusters, with S3 I/O support
Stars: ✭ 259 (+1077.27%)
Mutual labels:  aws-ec2
Aws Ec2 Ssh
Manage AWS EC2 SSH access with IAM
Stars: ✭ 796 (+3518.18%)
Mutual labels:  aws-ec2
Udacity Data Engineering Projects
Few projects related to Data Engineering including Data Modeling, Infrastructure setup on cloud, Data Warehousing and Data Lake development.
Stars: ✭ 458 (+1981.82%)
Mutual labels:  aws-ec2
Practicalnode
Practical Node.js, 1st and 2nd Editions [Apress] 📓
Stars: ✭ 3,694 (+16690.91%)
Mutual labels:  aws-ec2

lsec2

Workflow Status Go Report Card GolangCI Codecov MIT License

List view of AWS EC2 instances.

Example as follows.

$ lsec2 -H
INSTANCE_ID            PRIVATE_IP         PUBLIC_IP         TYPE        STATE      TAGS
i-0xxxxxxxxxxxxxx1     172.111.111.111    54.111.111.111    t2.micro    running    TagA=ValueA,TagB=ValueB
i-0xxxxxxxxxxxxxx2     172.222.222.222    54.222.222.222    t2.medium   running    TagAA=ValueAA
i-0xxxxxxxxxxxxxx3     172.333.333.333    54.333.333.333    t1.large    stopped

Install

Using Homebrew for OS X

$ brew install goldeneggg/tap/lsec2

Note:

If you have already installed an old version's lsec2 using brew tap goldenegg/lsec2 command and brew install lsec2 command, please uninstall old version.

# uninstall old tap version
$ brew uninstall lsec2
$ brew untap goldeneggg/lsec2

# and install new tap version
$ brew install goldeneggg/tap/lsec2

Or go get

$ go get -u github.com/goldeneggg/lsec2

Or direct download

Download from latest release

Configuration

Create ~/.aws/credentials file

If you have already installed aws-cli, I recommend setting up by aws configure command.

Write your credential information in ~/.aws/credentials file.

  • Write a section
    • Default is [default]. It's known as "Profile".
  • Write aws_access_key_id in your section
  • Write aws_secret_access_key in your section
[default]
aws_access_key_id = YOUR_ACCESS_KEY_ID
aws_secret_access_key = YOUR_SECRET_ACCESS_KEY

More information: session - Amazon Web Services - Go SDK

Or Set environment variables

2 variables are required

$ export AWS_ACCESS_KEY_ID=YOUR_ACCESS_KEY_ID
$ export AWS_SECRET_ACCESS_KEY=YOUR_SECRET_ACCESS_KEY

Change runtime profile

Use --profile option

[default]
aws_access_key_id = YOUR_ACCESS_KEY_ID
aws_secret_access_key = YOUR_SECRET_ACCESS_KEY

[test]
aws_access_key_id = YOUR_ACCESS_KEY_ID2
aws_secret_access_key = YOUR_SECRET_ACCESS_KEY2
$ lsec2  # use "default" profile
$ lsec2 --profile test  # use "test" profile

Use profile with AssumeRole

See https://github.com/goldeneggg/lsec2/pull/21

Usage

# print all instances info by list view
$ lsec2

Result contains informations of instances as follows

  • instance id
  • private ip address
  • public ip address
  • instance type
  • instance state
  • tags

Show more detail information by typing lsec2 -h

Assign region

You can use 3 patterns

  • assign by --region option (top priority)
$ lsec2 --region ap-northeast-1
  • write region key in ~/.aws/config file
$ vi ~/.aws/config
[default]
region = ap-northeast-1
  • set AWS_REGION environment
$ export AWS_REGION=ap-northeast-1

Show more information from public AWS documents

Filter by tag

# filterd by a tag key-value separated by "="
$ lsec2 TagName1=tagvalue1

# filterd by some tags
$ lsec2 TagName1=tagvalue1 TagNameN=tagvalueN

# filterd by a tag multiple values separated by comma
$ lsec2 TagName1=tagvalue11,tagvalue12,tagvalue1N

Options

# with header
$ lsec2 -H

# filter state
$ lsec2 -s running
$ lsec2 -s stopped
$ lsec2 -s OTHER_STATE

# print only private IP address
$ lsec2 -p

# print state with color
# ("running" is green, "stopped" is red, and others are yellow)
$ lsec2 -c

# change column delimiter (default delimiter is TAB)
$ lsec2 -d ,

Tips

With peco

peco is a very useful interactive filtering tool.

  • Example: print instances => select instance => SSH to selected instance
# add function to your .bashrc or .bash_profile or other shell dotfile
$ vi YOUR_DOTFILE

lssh () {
  IP=$(lsec2 [email protected] | peco | awk -F "\t" '{print $2}')
  if [ $? -eq 0 -a "${IP}" != "" ]
  then
      ssh ${IP}
  fi
}


# load dotfile
$ source YOUR_DOTFILE

# shortcut "lsec2 OPTIONS TAG_FILTERS" => "ssh PRIVATE_IP"
$ lssh TagName1=tagvalue1

With gat

gat is a file posting tool to various services like cat command.

  • Example: print instances => share your slack
# shortcut "lsec2 OPTIONS TAG_FILTERS" => copy this results to your slack channel
$ lsec2 TagName1=tagvalue1 | gat slack

Contribute

Please follow Contributor's Guide

Contact

Bugs: issues

ChangeLog

CHANGELOG file for details.

License

LICENSE file for details.

Special Thanks

@sugitak

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].