Skip to content

[EC2] Fix empty instance type lists for af-south-1 and ap-northeast-3 - #2234

Open
shaynhornik wants to merge 1 commit into
apache:trunkfrom
shaynhornik:fix/ec2-af-south-1-instance-types
Open

shaynhornik wants to merge 1 commit into
apache:trunkfrom
shaynhornik:fix/ec2-af-south-1-instance-types

Conversation

@shaynhornik

Copy link
Copy Markdown

[EC2] Fix empty instance type lists for af-south-1 and ap-northeast-3

Description

Fixes #1984. list_sizes() returns nothing for af-south-1 and ap-northeast-3, so a node can't be created there, because both regions have an empty instance_types list in ec2_region_details_complete.py.

The cause is in contrib/scrape-ec2-sizes.py. Its REGION_DETAILS table is keyed by the location attribute of the AWS price list, and products with an unknown location are skipped:

  • af-south-1 was keyed by its region id instead of Africa (Cape Town).
  • ap-northeast-3 was keyed Asia Pacific (Osaka-Local); AWS now calls it Asia Pacific (Osaka).

Changes:

  • Fix both keys in the scraper. Run against the per-region price lists, its parse() finds 0 instance types for these regions before and 439 / 405 after.
  • Fill in instance_types for the two regions. A full regenerate needs the 9 GB global price list, so I used the two per-region price lists with the scraper's own selection, and kept only types that already have a size definition in ec2_instance_types.py:
Region In the AWS price list Added Left out (no size definition yet)
af-south-1 439 346 93
ap-northeast-3 405 384 21

The types left out are newer families (c8i, m8i, r8i, i7i, i8g and similar). They will come in with the next full scrape, which now recognizes both regions.

  • Add a test that both regions list sizes, including m6i.xlarge, the type from the issue.

No other region is touched. git diff --patience shows the real change to the constants file (+736/−4); the default diff looks larger because it matches lines across regions.

Not changed here: us-gov-west-1 is also empty for the same kind of reason (the scraper has AWS GovCloud (US), the price list says AWS GovCloud (US-West)). I can send that separately if you want it. cn-north-1 and cn-northwest-1 are not in this price list at all.

Status

Done, ready for review.

Checklist (tick everything that applies)

  • Code linting (required, can be done after the PR checks)
  • Documentation (CHANGES.rst)
  • Tests
  • ICLA (required for bigger changes)

Run locally: libcloud/test/compute (4830 passed, 5 skipped), black, isort, flake8 and rstcheck. The new test fails on trunk with "No sizes available in region af-south-1".

Generated-by: Claude Code (Claude Fable 5.2). I reviewed and tested the change.

🤖 Generated with Claude Code

The sizing data scraper matches products by the "location" attribute of
the AWS price list, but af-south-1 was keyed by its region id and
ap-northeast-3 by the old "Asia Pacific (Osaka-Local)" name, so every
product for those two regions was skipped. Both regions ended up with an
empty instance type list and list_sizes() returned no sizes for them.
Key both regions by the location names AWS uses and fill in their
instance types from the current per-region AWS price lists, limited to
types which already have a size definition.

Generated-by: Claude Code (Claude Fable 5.2)
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

InstanceTypes not available in af-south-1

1 participant