README.md in ec2spec-0.1.1 vs README.md in ec2spec-0.1.2

- old
+ new

@@ -1,35 +1,103 @@ # ec2spec -Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/ec2spec`. To experiment with that code, run `bin/console` for an interactive prompt. +[![Gem Version](https://badge.fury.io/rb/ec2spec.svg)](https://badge.fury.io/rb/ec2spec) +[![Build Status](https://travis-ci.org/kyoshidajp/ec2spec.svg?branch=master)](https://travis-ci.org/kyoshidajp/ec2spec) +[![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)][license] -TODO: Delete this and the text above, and describe your gem +[license]: https://github.com/kyoshidajp/ec2spec/blob/master/LICENSE +ec2spec is a simple comparison tool for Amazon EC2 Instances you can access. + +Supports the following items. + +| item | from | +| :------- | :------ | +| instance type | host | +| instance id | host | +| vCPU | AWS Price List API | +| memory | AWS Price List API | +| price | AWS Price List API | + +The target host must be accessible from the machine. Also, only On-Demand way and Linux machine. + ## Installation -Add this line to your application's Gemfile: +``` +$ gem install ec2spec +``` -```ruby -gem 'ec2spec' +## Usage + ``` +$ ec2spec ssh -h host1 ... [options] +``` -And then execute: +### Options - $ bundle +``` +-h, --host Target hosts name. -Or install it yourself as: +--days How many days per one month. - $ gem install ec2spec +--format Output format (default: plain_text). + plain_text, json, hash -## Usage +--region Region of EC2 (default: ap-northeast-1). -TODO: Write usage instructions here +--debug Output logs as DEBUG level. +``` -## Development +### Example -After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. +``` +$ ec2spec ssh -h host1 host2 host3 +``` -To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org). +``` +I, [2018-08-12T20:54:25.814752 #64341] INFO -- : Started: host1 +I, [2018-08-12T20:54:25.814835 #64341] INFO -- : Started: host2 +I, [2018-08-12T20:54:25.814867 #64341] INFO -- : Started: host3 +I, [2018-08-12T20:54:25.826113 #64341] INFO -- : Finished: host3 +I, [2018-08-12T20:54:29.385848 #64341] INFO -- : Finished: host1 +I, [2018-08-12T20:54:37.560003 #64341] INFO -- : Finished: host2 ++---------------+-------------+-------------+-------+ +| | host1 | host2 | host3 | ++---------------+-------------+-------------|-------+ +| instance_type | t2.micro | c4.2xlarge | N/A | +| instance_id | i-xxxxxxxx | i-yyyyyyyy | N/A | +| vCPU | 1 | 8 | N/A | +| memory | 1 GiB | 15 GiB | N/A | +| price (USD/H) | 0.0152 | 0.504 | N/A | +| price (USD/M) | 11.3088 | 374.976 | N/A | ++---------------+-------------+---------------------+ +``` + +The data of `host3` could not be acquired due to some error. + +## As a library + +``` +> require 'ec2spec' +> hosts = %w[host1 host2] +> client = Ec2spec::Client.new(hosts, 30, 'hash') +> result_json = client.run +> puts result_json +I, [2018-08-12T20:54:25.814752 #64341] INFO -- : Started: host1 +I, [2018-08-12T20:54:25.814835 #64341] INFO -- : Started: host2 +I, [2018-08-12T20:54:29.385848 #64341] INFO -- : Finished: host1 +I, [2018-08-12T20:54:37.560003 #64341] INFO -- : Finished: host2 +=> {"host1":{"instance_type":"t2.micro","instance_id":"i-xxxxxxxx","vCPU":"1","memory":"1 GiB","price (USD/H)":0.152,"price (USD/M)":11.3088},"host2":{"instance_type":"c4.2xlarge","instance_id":"i-yyyyyyyy","vCPU":"8","memory":"15 GiB","price (USD/H)":0.504,"price (USD/M)":374.976}} +``` + +## Requirement + +- Ruby(MRI) 2.3.0 or higher + +## Competitors + +- [Amazon Web Services Simple Monthly Calculator](https://calculator.s3.amazonaws.com/index.html) +- [Amazon EC2 Instance Comparison](https://www.ec2instances.info/) ## Contributing Bug reports and pull requests are welcome on GitHub at https://github.com/kyoshidajp/ec2spec.