Giter VIP home page Giter VIP logo

ec2instancespricing's People

Contributors

acaire avatar bbaetz avatar danpritts avatar douglas-gibbons avatar erans avatar evgeny-gridasov avatar igarag avatar iluvpcs avatar james-valente-simplisafe avatar jbarguil avatar jdieguez avatar jimbrowne avatar kepstein avatar michaelhood avatar pdufault avatar quinnypig avatar raizyr avatar rykhawthorn avatar thehesiod avatar tonsmets avatar uovobw avatar yudelevi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ec2instancespricing's Issues

Amazon mappings changed?

Thanks for your efforts on this project.

There is some evidence that Amazon's json pages may have changed format today. Have you had experience with this?

Test program (foo.py):

#!/usr/bin/env python

from ec2instancespricing import ec2instancespricing

prices = ec2instancespricing.get_ec2_ondemand_instances_prices()

Results:

$ python foo.py
Traceback (most recent call last):
File "foo.py", line 5, in
prices = ec2instancespricing.get_ec2_ondemand_instances_prices()
File ".../libs/ec2instancespricing/ec2instancespricing.py", line 456, in get_ec2_ondemand_instances_prices
instance_size = INSTANCE_SIZE_MAPPING[s["size"]]
KeyError: 'm1.small'

readme - should reference demjson

Just picking nits, but in addition to argparse and prettytables, I had to run easy_install demjson before running the python script.

No ap-south-1 in map JSON_NAME_TO_EC2_REGIONS_API

Traceback:
File "./ec2instancespricing/ec2instancespricing.py", line 510, in get_ec2_instances_prices
region_name = JSON_NAME_TO_EC2_REGIONS_API[r["region"]]
KeyError: u'ap-south-1'

Fixed by adding new entity to map

  • "ap-south-1": "ap-south-1",

New AWS Regions

Need to add Canada and London

"ca-central-1": "ca-central-1",

"eu-west-2": "eu-west-2",

How to run ec2instancespricing.py script

I would like to how to run this script is there any specific parameter args I need to run the script right now im just using python ec2instancespricing.py. However I'm getting this error when running the scripts

Traceback (most recent call last):
File "ec2instancespricing.py", line 854, in
data, _ = _get_data(args)
File "ec2instancespricing.py", line 801, in _get_data
data = merge_instances(data, get_ec2_spot_instances_prices(args.filter_region, args.filter_type, args.filter_type_pattern, args.filter_os_type))
File "ec2instancespricing.py", line 739, in get_ec2_spot_instances_prices
result = get_ec2_instances_prices(urls, "spot", filter_region, filter_instance_type, filter_instance_type_pattern, filter_os_type, use_cache, cache_class)
File "ec2instancespricing.py", line 544, in get_ec2_instances_prices
region_name = JSON_NAME_TO_EC2_REGIONS_API[r["region"]]
KeyError: 'us-west-2-lax-1a'

Typos in readme

Missing an n here!

get_ec2_ondemand_instances_prices - to get the pricing of On-Demand instances
get_ec2_reserved_instances_prices - to get the pricing of reserved instances (in all utilization levels)
get_ec2_spot_instances_prices - to get the pricing of spot instances

json import missing

I'm runnning the script like this:

./ec2instancespricing.py --type ondemand --filter-region us-east-1 --filter-type 'm3.2xlarge' --filter-os-type 'linux' --format json

And I'm getting this error:

Traceback (most recent call last):
  File "./ec2instancespricing.py", line 527, in <module>
    print json.dumps(data)
NameError: name 'json' is not defined

The problem is that, when the json module was changed, it was forgotten to change this line.

pypi package

It would be awesome if this were in pip.

Hynek wrote a nice guide.

If I had some time, I'd do this in my fork.

Thanks for creating this.

KeyError: u'ap-east-1'

Hello

I am getting an error:

KeyError: u'ap-east-1'

when trying to run the CLI

Traceback (most recent call last):
File "Library/Python/2.7/bin/ec2instancespricing.py", line 4, in
import('pkg_resources').run_script('ec2instancespricing==0.1', 'ec2instancespricing.py')
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/init.py", line 742, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/init.py", line 1674, in run_script
exec(script_code, namespace, namespace)
File "/Users/jamesgardiner/Library/Python/2.7/lib/python/site-packages/ec2instancespricing-0.1-py2.7.egg/EGG-INFO/scripts/ec2instancespricing.py", line 852, in

File "/Users/jamesgardiner/Library/Python/2.7/lib/python/site-packages/ec2instancespricing-0.1-py2.7.egg/EGG-INFO/scripts/ec2instancespricing.py", line 799, in _get_data

File "/Users/jamesgardiner/Library/Python/2.7/lib/python/site-packages/ec2instancespricing-0.1-py2.7.egg/EGG-INFO/scripts/ec2instancespricing.py", line 737, in get_ec2_spot_instances_prices

File "/Users/jamesgardiner/Library/Python/2.7/lib/python/site-packages/ec2instancespricing-0.1-py2.7.egg/EGG-INFO/scripts/ec2instancespricing.py", line 542, in get_ec2_instances_prices

Generate instance type array programmatically?

If you're willing to pull in botocore,

import botocore.session

sess = botocore.session.Session()
available_types = sess.get_service_model('ec2').shape_for('InstanceType').enum

generates the instance type list at runtime; wouldn't be hard to work that in instead.

How do you feel about that, philosophically?

Install via pip not working

In [2]: import ec2instancespricing

ImportError Traceback (most recent call last)
in ()
----> 1 import ec2instancespricing

/usr/local/lib/python2.7/dist-packages/ec2instancespricing/init.py in ()
----> 1 from ec2instancespricing.ec2instancespricing import get_prices

ImportError: No module named ec2instancespricing

How to run this code?

Hi, I am trying to run this code using python but it is not running? Can you please tell me how I can run this? Thanks.

License

Hi,

It would be great if you could specify what license this code is released under. MIT, BSD or Apache would be ideal. Otherwise no one is able to legally use or extend this code!

Thanks

Price differences with the pricing page

I'm looking for the prices for ondemand, us-east-1, linux, m3.2xlarge. In the page, it says that the price is $0.560:

image

But when I run the script like this:

./ec2instancespricing.py --type ondemand --filter-region us-east-1 --filter-type 'm3.2xlarge' --filter-os-type 'linux' --format json

The output is:

{"regions": [{"region": "us-east-1", "instanceTypes": [{"os": "linux", "price": 0.9, "type": "m3.2xlarge"}]}], "config": {"currency": "USD", "unit": "perhr"}}

I think the problem is that the API may be deprecated. If you make a request to http://aws.amazon.com/ec2/pricing/pricing-on-demand-instances.json, you will see that it redirects to a deprecated API.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.