srbartlett / awscosts Goto Github PK
View Code? Open in Web Editor NEWProgrammatic access to AWS pricing
License: MIT License
Programmatic access to AWS pricing
License: MIT License
In 82ce80d you switched to using oj, which means when this gem is used in JRuby it requires C extensions to be enabled.
Was there any specific reason for oj? I suspect it is slightly faster than JSON...?
When attempting to use the following:
def get_region_cost(region)
return AWSCosts.region(region).ec2.on_demand(:linux).price
end
I found that certain regions cause the following error:
test.rb:22:in `get_region_cost': undefined method `ec2' for nil:NilClass (NoMethodError)
from test.rb:28:in `block in get_ec2_costs'
from test.rb:27:in `each'
from test.rb:27:in `get_ec2_costs'
from test.rb:33:in `<main>'
The following regions cause this issue:
ap-south-1
eu-west-2
ap-northeast-2
ca-central-1
us-east-2
Hi, i am currently using this ruby library, and there are lots of missing missing ec2 families (m4, m3, c4 etc..) . I saw that each implementation of on_demand and reserved methods have a different translator for ec2 families, should be better to have one centralized that is obtained from the aws api directly?
Just noticed `httparty' is not listed as a dependency in the gemspec, is there a reason for this?
The json file you are using has old pricing.
https://github.com/CloudHealth/awscosts/tree/switch_to_jsonp_source has changes to use the latest source. I'd be happy to get the branch into a state that it can be merged into yours.
Also have https://github.com/CloudHealth/awscosts/tree/ebs_optimized to pull in ebs_optimized pricing.
Let me know what you think...
If I get a moment I will try to add support for more regions.
We're missing:
ref: http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region
AWSCosts.region('eu-west-1').ec2.elb.price(:standard)
should be
AWSCosts.region('eu-west-1').ec2.ebs.price(:standard)
I was copying code snippets from the README (so I've already set the region using the exact code under Usage) and I tried out the Reserved code in irb:
region.ec2.reserved(:windows, :light).upfront
Gave me this:
ArgumentError: wrong number of arguments (0 for 1) from /Users/victoria/.rvm/gems/ruby-1.9.3-p392/gems/awscosts-0.0.4/lib/awscosts/ec2_reserved_instances.rb:29:in `upfront' from (irb):7 from /Users/victoria/.rvm/rubies/ruby-1.9.3-p392/bin/irb:16:in `'
Upon running this in irb:
region.ec2.reserved(:windows_with_sql, :medium).hourly('m1.large')
I got this:
NoMethodError: undefined method `[]' for nil:NilClass from /Users/victorialouie/.rvm/gems/ruby-1.9.3-p392/gems/awscosts-0.0.4/lib/awscosts/ec2_reserved_instances.rb:41:in `hourly' from (irb):8 from /Users/victorialouie/.rvm/rubies/ruby-1.9.3-p392/bin/irb:16:in `'
I tried this simple code example and got a zero price back .. not sure this gem is working .. I've read recently that the JSON URL's were modified in AWS not sure if this is the cause of this GEM not working. Here's the basic code based on the docs that isn't working:
require 'rubygems'
require 'awscosts'
region = AWSCosts.region 'us-east-1'
curprice = region.ec2.on_demand(:linux).price('m1.medium')
This leaves me with a zero value in curprice variable and I'm pretty sure that's not right.
When performing this command:
region = AWSCosts.region 'us-east-1'
region.ec2.on_demand(:linux).price
This error occurs:
/usr/local/lib/ruby/gems/2.1.0/gems/awscosts-0.0.7/lib/awscosts/ec2_on_demand.rb:56:in `fetch': undefined method `[]' for nil:NilClass (NoMethodError)
from /usr/local/lib/ruby/gems/2.1.0/gems/awscosts-0.0.7/lib/awscosts/ec2.rb:19:in `on_demand'
from ./test.rb:41:in `<main>'
There is no issue when performing requests on reserved or ELB class!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.