diff --git a/src/rhelocator/update_images.py b/src/rhelocator/update_images.py index 75d12e79..069c4d85 100644 --- a/src/rhelocator/update_images.py +++ b/src/rhelocator/update_images.py @@ -18,7 +18,15 @@ def get_aws_regions() -> list[str]: List of AWS regions as strings. """ ec2 = boto3.client("ec2", region_name="us-east-1") - raw = ec2.describe_regions(AllRegions=True) + # TODO(mhayden): Remove the opt-in-status filter below once AWS enables the + # additional regions for the account. The opt-in was requested on 2022-10-11 but + # it could take time before they are enabled. + raw = ec2.describe_regions( + Filters=[ + {"Name": "opt-in-status", "Values": ["opt-in-not-required", "opted-in"]} + ], + AllRegions=True, + ) return sorted([x["RegionName"] for x in raw["Regions"]]) diff --git a/tests/test_update_images.py b/tests/test_update_images.py index 91a9859e..71e470c7 100644 --- a/tests/test_update_images.py +++ b/tests/test_update_images.py @@ -16,7 +16,15 @@ def test_get_aws_regions() -> None: with patch("botocore.client.BaseClient._make_api_call") as boto: update_images.get_aws_regions() - boto.assert_called_with("DescribeRegions", {"AllRegions": True}) + boto.assert_called_with( + "DescribeRegions", + { + "AllRegions": True, + "Filters": [ + {"Name": "opt-in-status", "Values": ["opt-in-not-required", "opted-in"]} + ], + }, + ) def test_aws_describe_images() -> None: