Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/progrhyme/ruby-ec2it

Handy AWS EC2 CLI for Ruby
https://github.com/progrhyme/ruby-ec2it

Last synced: 18 days ago
JSON representation

Handy AWS EC2 CLI for Ruby

Awesome Lists containing this project

README

        

# ec2it [![Build Status](https://travis-ci.org/key-amb/ruby-ec2it.svg?branch=master)](https://travis-ci.org/key-amb/ruby-ec2it)

Handy CLI for AWS EC2 operations.
Mainly focused on instance operations.

# Usage

```
# List(default)/Show instances
ec2it [-r <{Role}>] [-g <{Group}>] [-s ] [-k ...]
ec2it list [OPTIONS]
ec2it show -i [-k ...]
ec2it show -n [OPTIONS]

# Start/Stop instance
ec2it start -i [--dry-run]
ec2it start -n [--dry-run]
ec2it stop -i [--dry-run]
ec2it stop -n [--dry-run]

# Launch/Terminate instance
ec2it launch -i -n [-az AZ] [--dry-run]
ec2it terminate -i [--dry-run]
ec2it terminate -n [--dry-run]

# List/Create/Delete AMI
ec2it list-ami [-r <{Role}>] [-g <{Group}>]
ec2it create-ami -i [--dry-run]
ec2it create-ami -n [--dry-run]
ec2it delete-ami -i [--dry-run]

# Set role for Instance/AMI
ec2it set-role -r <{Role}> -i [--dry-run]
ec2it set-role -r <{Role}> -n [--dry-run]
ec2it set-role -r <{Role}> -i [--dry-run]

# Set group for Instance/AMI
ec2it set-group -r <{Group}> -i [--dry-run]
ec2it set-group -r <{Group}> -n [--dry-run]
ec2it set-group -r <{Group}> -i [--dry-run]

# Show help
ec2it help
```

As for `{Role}` and `{Group}`, see below description and samples.

## Options

`-c --config=/path/to/config.toml` is an only global option for CLI.
You can skip this option if you set `$EC2IT_CONFIG_PATH` as environment variable.

```sh
export EC2IT_CONFIG_PATH=/path/to/config.toml
```

# Configure

```sh
export AWS_REGION=ap-northeast-1 # Your AWS Region
export AWS_ACCESS_KEY_ID=
export AWS_SECRET_ACCESS_KEY=
```

See also [AWS SDK for Ruby v2](http://docs.aws.amazon.com/sdkforruby/api/index.html)
for more information.

You can see a sample of `config.toml` at [config/sample.toml](config/sample.toml).

## Role and Group

`{Role}` and `{Group}` are combination of tag values.
The keys of tags are configured as `.['tags']['roles']` and `.['tags']['groups']` .

Here is an example configuration:

```
[tags]
roles = [ "Role1", "Role2" ]
groups = [ "Group1", "Group2" ]
```

And below are examples.
They show when an instance or AMI have those tags, how their "role" and "group"
will be interpreted.

| Role1, Role2 | Group1, Group2 | role, group |
| ------------ | -------------- | ----------- |
| web, rails | EC, production | web:rails, EC:production |
| db, master | SNS, testing | db:master, SNS:testing |
| test | personal | test, personal |

# LICENSE

The MIT License (MIT)

Copyright (c) 2016 YASUTAKE Kiyoshi