diff --git a/HISTORY.rst b/HISTORY.rst
index 9a6d9e6..23dbfa2 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -2,6 +2,10 @@
 History
 =======
 
+* Return ``None`` for ``availability_zone_id`` when the underlying endpoint returns HTTP 404.
+
+  Thanks to Amir Rossert in `PR #350 <https://github.com/adamchainz/ec2-metadata/pull/350>`__.
+
 2.9.0 (2022-03-25)
 ------------------
 
diff --git a/README.rst b/README.rst
index 1671b48..f435b1f 100644
--- a/README.rst
+++ b/README.rst
@@ -133,8 +133,8 @@ See AWS docs page `Retrieve the target lifecycle state through instance metadata
 
 The name of the current AZ e.g. ``'eu-west-1a'``.
 
-``availability_zone_id: str``
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+``availability_zone_id: str | None``
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 The unique, cross-account ID of the current AZ e.g. ``'use1-az6'``.
 See AWS docs page `AZ IDs for your AWS resources
diff --git a/src/ec2_metadata/__init__.py b/src/ec2_metadata/__init__.py
index 0db8376..520d9aa 100644
--- a/src/ec2_metadata/__init__.py
+++ b/src/ec2_metadata/__init__.py
@@ -98,8 +98,13 @@ class EC2Metadata(BaseLazyObject):
         return self._get_url(f"{self.metadata_url}placement/availability-zone").text
 
     @cached_property
-    def availability_zone_id(self) -> str:
-        return self._get_url(f"{self.metadata_url}placement/availability-zone-id").text
+    def availability_zone_id(self) -> str | None:
+        resp = self._get_url(
+            f"{self.metadata_url}placement/availability-zone-id", allow_404=True
+        )
+        if resp.status_code == 404:
+            return None
+        return resp.text
 
     @cached_property
     def ami_launch_index(self) -> int:

diff --git a/tests/test_ec2_metadata.py b/tests/test_ec2_metadata.py
index 24f6af1..55f701b 100644
--- a/tests/test_ec2_metadata.py
+++ b/tests/test_ec2_metadata.py
@@ -161,6 +161,14 @@ def test_availability_zone_id(em_requests_mock):
     assert ec2_metadata.availability_zone_id == "use1-az6"
 
 
+def test_availability_zone_id_none(em_requests_mock):
+    em_requests_mock.get(
+        "http://169.254.169.254/latest/meta-data/placement/availability-zone-id",
+        status_code=404,
+    )
+    assert ec2_metadata.availability_zone_id is None
+
+
 def test_domain(em_requests_mock):
     em_requests_mock.get(
         "http://169.254.169.254/latest/meta-data/services/domain",

availability_zone_id may return 404
### Python Version

3.8.10

### Package Version

2.7.0

### Description

In some cases `ec2_metadata.availability_zone_id` returns 404
```
----> 1 ec2_metadata.availability_zone_id
File functools.py:967, in __get__(self, instance, owner)
File ec2_metadata/__init__.py:87, in availability_zone_id(self)
File ec2_metadata/__init__.py:65, in _get_url(self, url, allow_404)
File requests/models.py:960, in raise_for_status(self)
HTTPError: 404 Client Error: Not Found for url: http://169.254.169.254/latest/meta-data/placement/availability-zone-id
```
I assume that all that is needed is to use `allow_404` in `_get_url`
tests/test_ec2_metadata.py::test_availability_zone_id_none
tests/test_ec2_metadata.py::test_instance_profile_name tests/test_ec2_metadata.py::test_network_interface_repr tests/test_ec2_metadata.py::test_public_hostname_none tests/test_ec2_metadata.py::test_tags_one tests/test_ec2_metadata.py::test_kernel_id tests/test_ec2_metadata.py::test_network_interface_owner_id tests/test_ec2_metadata.py::test_instance_profile_id tests/test_ec2_metadata.py::test_instance_type tests/test_ec2_metadata.py::test_iam_info_none tests/test_ec2_metadata.py::test_network_interface_device_number tests/test_ec2_metadata.py::test_instance_profile_arn_none tests/test_ec2_metadata.py::test_network_interface_subnet_ipv4_cidr_block tests/test_ec2_metadata.py::test_region tests/test_ec2_metadata.py::test_network_interface_subnet_id tests/test_ec2_metadata.py::test_autoscaling_target_lifecycle_state_none tests/test_ec2_metadata.py::test_network_interface_vpc_ipv4_cidr_block tests/test_ec2_metadata.py::test_network_interface_ipv6s tests/test_ec2_metadata.py::test_tags_multiple tests/test_ec2_metadata.py::test_ami_id_cached tests/test_ec2_metadata.py::test_spot_instance_action_none tests/test_ec2_metadata.py::test_account_id_token_error tests/test_ec2_metadata.py::test_security_groups_emptystring tests/test_ec2_metadata.py::test_instance_profile_arn tests/test_ec2_metadata.py::test_network_interface_vpc_ipv6_cidr_blocks_none tests/test_ec2_metadata.py::test_instance_identity tests/test_ec2_metadata.py::test_network_interface_private_ipv4s tests/test_ec2_metadata.py::test_tags_len tests/test_ec2_metadata.py::test_network_interface_public_ipv4s_empty tests/test_ec2_metadata.py::test_domain tests/test_ec2_metadata.py::test_ami_id_cached_cleared tests/test_ec2_metadata.py::test_public_ipv4_none tests/test_ec2_metadata.py::test_network_interfaces tests/test_ec2_metadata.py::test_tags_empty tests/test_ec2_metadata.py::test_ami_manifest_path tests/test_ec2_metadata.py::test_network_interface_ipv4_associations tests/test_ec2_metadata.py::test_network_interface_vpc_ipv6_cidr_blocks tests/test_ec2_metadata.py::test_availability_zone tests/test_ec2_metadata.py::test_network_interface_vpc_id tests/test_ec2_metadata.py::test_network_interface_not_equal tests/test_ec2_metadata.py::test_kernel_id_none tests/test_ec2_metadata.py::test_private_hostname tests/test_ec2_metadata.py::test_network_interface_public_ipv4s tests/test_ec2_metadata.py::test_iam_security_credentials_none tests/test_ec2_metadata.py::test_account_id_error tests/test_ec2_metadata.py::test_iam_security_credentials tests/test_ec2_metadata.py::test_instance_profile_id_none tests/test_ec2_metadata.py::test_tags_repeat_access tests/test_ec2_metadata.py::test_network_interface_subnet_ipv6_cidr_blocks_none tests/test_ec2_metadata.py::test_instance_action tests/test_ec2_metadata.py::test_network_interface_vpc_ipv4_cidr_blocks_none tests/test_ec2_metadata.py::test_autoscaling_target_lifecycle_state_in_service tests/test_ec2_metadata.py::test_account_id tests/test_ec2_metadata.py::test_tags_not_enabled tests/test_ec2_metadata.py::test_network_interface_public_hostname_none tests/test_ec2_metadata.py::test_network_interface_interface_id tests/test_ec2_metadata.py::test_availability_zone_id tests/test_ec2_metadata.py::test_user_data_none tests/test_ec2_metadata.py::test_reservation_id tests/test_ec2_metadata.py::test_network_interface_public_hostname tests/test_ec2_metadata.py::test_network_interface_not_equal_class tests/test_ec2_metadata.py::test_network_interface_ipv6s_none tests/test_ec2_metadata.py::test_iam_info_unexpected tests/test_ec2_metadata.py::test_security_groups_two tests/test_ec2_metadata.py::test_spot_instance_action tests/test_ec2_metadata.py::test_network_interface_private_hostname tests/test_ec2_metadata.py::test_custom_session tests/test_ec2_metadata.py::test_network_interface_equal tests/test_ec2_metadata.py::test_user_data_something tests/test_ec2_metadata.py::test_network_interface_vpc_ipv4_cidr_blocks tests/test_ec2_metadata.py::test_security_groups_single tests/test_ec2_metadata.py::test_partition tests/test_ec2_metadata.py::test_instance_id tests/test_ec2_metadata.py::test_network_interface_subnet_ipv4_cidr_block_none tests/test_ec2_metadata.py::test_mac tests/test_ec2_metadata.py::test_private_ipv4 tests/test_ec2_metadata.py::test_ami_launch_index tests/test_ec2_metadata.py::test_public_hostname tests/test_ec2_metadata.py::test_tags_iter tests/test_ec2_metadata.py::test_public_ipv4 tests/test_ec2_metadata.py::test_network_interface_subnet_ipv6_cidr_blocks tests/test_ec2_metadata.py::test_ami_id tests/test_ec2_metadata.py::test_network_interface_vpc_ipv4_cidr_block_none tests/test_ec2_metadata.py::test_network_interface_security_group_ids tests/test_ec2_metadata.py::test_iam_info tests/test_ec2_metadata.py::test_network_interface_security_groups