yeo / ec2.shop

fastest way to check and compare ec2 and other aws service pricing
https://ec2.shop
MIT License
112 stars 17 forks source link

Setting JSON return type nullfies any filters #6

Closed hahuang65 closed 4 years ago

hahuang65 commented 4 years ago

curl --silent "https://ec2.shop?filter=m4" --header 'accept: json'

will seemingly return all instance types whereas

curl --silent "https://ec2.shop?filter=m4"

will return just m4 instances

v9n commented 4 years ago

@hahuang65 Sorry for the issue. It should be fixed now.

 curl -sH 'accept:json' -L 'ec2.shop?filter=t2' | jq .
{
  "Prices": [
    {
      "InstanceType": "t2.small",
      "Memory": "2 GiB",
      "VCPUS": 1,
      "Storage": "EBS only",
      "Network": "Low to Moderate",
      "Cost": 0.023
    },
    {
      "InstanceType": "t2.medium",
      "Memory": "4 GiB",
      "VCPUS": 2,
      "Storage": "EBS only",
      "Network": "Low to Moderate",
      "Cost": 0.0464
    },
    {
      "InstanceType": "t2.nano",
      "Memory": "0.5 GiB",
      "VCPUS": 1,
      "Storage": "EBS only",
      "Network": "Low",
      "Cost": 0.0058
    },
    {
      "InstanceType": "t2.large",
      "Memory": "8 GiB",
      "VCPUS": 2,
      "Storage": "EBS only",
      "Network": "Low to Moderate",
      "Cost": 0.0928
    },
    {
      "InstanceType": "t2.xlarge",
      "Memory": "16 GiB",
      "VCPUS": 4,
      "Storage": "EBS only",
      "Network": "Moderate",
      "Cost": 0.1856
    },
    {
      "InstanceType": "t2.micro",
      "Memory": "1 GiB",
      "VCPUS": 1,
      "Storage": "EBS only",
      "Network": "Low to Moderate",
      "Cost": 0.0116
    },
    {
      "InstanceType": "t2.2xlarge",
      "Memory": "32 GiB",
      "VCPUS": 8,
      "Storage": "EBS only",
      "Network": "Moderate",
      "Cost": 0.3712
    }
  ]
}
hahuang65 commented 4 years ago

Awesome! Thanks for the quick fix!