vantage-sh / ec2instances.info

Amazon EC2 instance comparison site
https://ec2instances.info
MIT License
5.16k stars 583 forks source link

Viewing instances by region and availability zone (AZ) #439

Open jocull opened 5 years ago

jocull commented 5 years ago

I believe this change would require API access, since I don't know where it could be scraped from. The information is very tedious to find. Here's the information I have available on how to determine if an instance type is present in a region + AZ:

The best advice we've had is to query the billing API. If cost != null, there are probably instances available

Is this something that would be possible to add? Thanks :slightly_smiling_face:

cristim commented 5 years ago

The AZ labels are randomly assigned and account specific, my us-east-1a can be your us-east-1b and someone else's us-east-1c and so on.

We may be able to count the number of AZs and display something like 2/3 if only available in two out of three AZs.

jocull commented 5 years ago

Great information to have - I was not aware of that :)

Feel free to close issue in this case or re-open as something more appropriate. Thanks for the response!

cristim commented 5 years ago

I don't know, would you find useful such a field indicating the number of AZs having support for each instance type out of the total number of AZs in the region?

jocull commented 5 years ago

I think that could still be very useful - most importantly if it's 100% of the AZs or not :smile: I like the example you provided of seeing "2/3 AZs" or something to that effect.

burck1 commented 3 years ago

I would be interested in contributing to this feature. Can someone point me to where I can get started?

It looks like since this issue was opened AWS has released an API for this info. Here's the corresponding AWS CLI command: https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-instance-type-offerings.html

To list the instance types offered in a Region:

$ aws ec2 describe-instance-type-offerings --region us-east-1
{
  "InstanceTypeOfferings": [
      {
          "InstanceType": "m5.2xlarge",
          "LocationType": "region",
          "Location": "us-east-1"
      },
      {
          "InstanceType": "t3.micro",
          "LocationType": "region",
          "Location": "us-east-1"
      },
      ...
  ]
}

To list the instance types offered in all availability zones for a given account and region:

$ aws ec2 describe-instance-type-offerings --location-type availability-zone --region us-east-1
{
    "InstanceTypeOfferings": [
        {
            "InstanceType": "t4g.medium",
            "LocationType": "availability-zone",
            "Location": "us-east-1a"
        },
        {
            "InstanceType": "r5n.2xlarge",
            "LocationType": "availability-zone",
            "Location": "us-east-1d"
        },
        {
            "InstanceType": "x1e.2xlarge",
            "LocationType": "availability-zone",
            "Location": "us-east-1d"
        },
        {
            "InstanceType": "m5.24xlarge",
            "LocationType": "availability-zone",
            "Location": "us-east-1b"
        },
        ...
    ]
}

Since the Locations returned are specific to a given AWS account, we would also need to map those to the corresponding availability zone ids which are not specific to a given AWS account. This is the ZoneId in the following response:

$ aws ec2 describe-availability-zones --region us-east-1
{
    "AvailabilityZones": [
        {
            "State": "available",
            "OptInStatus": "opt-in-not-required",
            "Messages": [],
            "RegionName": "us-east-1",
            "ZoneName": "us-east-1a",
            "ZoneId": "use1-az1",
            "GroupName": "us-east-1",
            "NetworkBorderGroup": "us-east-1",
            "ZoneType": "availability-zone"
        },
        {
            "State": "available",
            "OptInStatus": "opt-in-not-required",
            "Messages": [],
            "RegionName": "us-east-1",
            "ZoneName": "us-east-1b",
            "ZoneId": "use1-az2",
            "GroupName": "us-east-1",
            "NetworkBorderGroup": "us-east-1",
            "ZoneType": "availability-zone"
        },
        ...
    ]
}

So we should be able to publish something along the lines of:

Name API Name Supported AZs
T3 Nano t3.nano use1-az1, use1-az2, use1-az4, use1-az5, use1-az6
M5 General Purpose Large m5.large use1-az1, use1-az2, use1-az3
C5 High-CPU 9xlarge c5.9xlarge use1-az1, use1-az2, use1-az3, use1-az4, use1-az5, use1-az6
jocull commented 3 years ago

The AZ aliases you have listed above are more deterministic now. The AWS Resource Access Manager (RAM) lists what "your" account's AZs are vs. the deterministic AZ identifiers you see listed here above 😄

burck1 commented 3 years ago

I've submitted a PR #544 with some screenshots.

jxu commented 2 years ago

Can the site sort by cost per region?

EverettBerry commented 2 years ago

@jxu currently it is scoped to a region but this would be an interesting addition. Are you trying to find the cheapest instance in a particular region? It seems like us-east-1 will always be cheapest.