Repository: localstack/localstack

Issue:
bug: ec2 describe-availability-zones with --zone-ids returns all zones
### Is there an existing issue for this?

- [X] I have searched the existing issues

### Current Behavior

Similar to [bug: ec2 describe-availability-zones with --zone-name returns all zones](https://github.com/localstack/localstack/issues/4715) but with `--zone-ids`.

```
aws --endpoint http://localhost:4566 ec2 describe-availability-zones
{
    "AvailabilityZones": [
        {
            "State": "available",
            "Messages": [],
            "RegionName": "eu-west-1",
            "ZoneName": "eu-west-1a",
            "ZoneId": "euw1-az3",
            "ZoneType": "availability-zone"
        },
        {
            "State": "available",
            "Messages": [],
            "RegionName": "eu-west-1",
            "ZoneName": "eu-west-1b",
            "ZoneId": "euw1-az1",
            "ZoneType": "availability-zone"
        },
        {
            "State": "available",
            "Messages": [],
            "RegionName": "eu-west-1",
            "ZoneName": "eu-west-1c",
            "ZoneId": "euw1-az2",
            "ZoneType": "availability-zone"
        }
    ]
}
```

```
aws --endpoint http://localhost:4566 ec2 describe-availability-zones --zone-ids euw1-az2
{
    "AvailabilityZones": [
        {
            "State": "available",
            "Messages": [],
            "RegionName": "eu-west-1",
            "ZoneName": "eu-west-1a",
            "ZoneId": "euw1-az3",
            "ZoneType": "availability-zone"
        },
        {
            "State": "available",
            "Messages": [],
            "RegionName": "eu-west-1",
            "ZoneName": "eu-west-1b",
            "ZoneId": "euw1-az1",
            "ZoneType": "availability-zone"
        },
        {
            "State": "available",
            "Messages": [],
            "RegionName": "eu-west-1",
            "ZoneName": "eu-west-1c",
            "ZoneId": "euw1-az2",
            "ZoneType": "availability-zone"
        }
    ]
}
```

### Expected Behavior

```
aws --endpoint http://localhost:4566 ec2 describe-availability-zones --zone-ids euw1-az2
{
    "AvailabilityZones": [
        {
            "State": "available",
            "Messages": [],
            "RegionName": "eu-west-1",
            "ZoneName": "eu-west-1c",
            "ZoneId": "euw1-az2",
            "ZoneType": "availability-zone"
        }
    ]
}
```
Similar to real AWS:
```
aws ec2 describe-availability-zones --zone-ids euw1-az2
{
    "AvailabilityZones": [
        {
            "State": "available",
            "OptInStatus": "opt-in-not-required",
            "Messages": [],
            "RegionName": "eu-west-1",
            "ZoneName": "eu-west-1c",
            "ZoneId": "euw1-az2",
            "GroupName": "eu-west-1",
            "NetworkBorderGroup": "eu-west-1",
            "ZoneType": "availability-zone"
        }
    ]
}
```

### How are you starting LocalStack?

With a `docker run` command

### Steps To Reproduce

#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)

    docker run localstack/localstack

#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)

    awslocal s3 mb s3://mybucket


### Environment

```markdown
- OS:Ubuntu 22.04
- LocalStack: 2.2.0
```


### Anything else?

_No response_


Discussion:
Welcome to LocalStack! Thanks for reporting your first issue and our team will be working towards fixing the issue for you or reach out for more background information. We recommend joining our [Slack Community](https://localstack.cloud/contact/) for real-time help and drop a message to LocalStack Pro Support if you are a Pro user! If you are willing to contribute towards fixing this issue, please have a look at our [contributing guidelines](https://github.com/localstack/.github/blob/main/CONTRIBUTING.md) and our [contributing guide](https://docs.localstack.cloud/contributing/).

Resolving patch:
diff --git a/localstack/services/ec2/provider.py b/localstack/services/ec2/provider.py
--- a/localstack/services/ec2/provider.py
+++ b/localstack/services/ec2/provider.py
@@ -97,25 +97,25 @@ def describe_availability_zones(
         describe_availability_zones_request: DescribeAvailabilityZonesRequest,
     ) -> DescribeAvailabilityZonesResult:
         backend = get_ec2_backend(context.account_id, context.region)
-
-        availability_zones = []
         zone_names = describe_availability_zones_request.get("ZoneNames")
-        if zone_names:
-            for zone in zone_names:
-                zone_detail = backend.get_zone_by_name(zone)
-                if zone_detail:
-                    availability_zones.append(
-                        AvailabilityZone(
-                            State="available",
-                            Messages=[],
-                            RegionName=zone_detail.region_name,
-                            ZoneName=zone_detail.name,
-                            ZoneId=zone_detail.zone_id,
-                        )
-                    )
-
+        zone_ids = describe_availability_zones_request.get("ZoneIds")
+        if zone_names or zone_ids:
+            filters = {
+                "zone-name": zone_names,
+                "zone-id": zone_ids,
+            }
+            filtered_zones = backend.describe_availability_zones(filters)
+            availability_zones = [
+                AvailabilityZone(
+                    State="available",
+                    Messages=[],
+                    RegionName=zone.region_name,
+                    ZoneName=zone.name,
+                    ZoneId=zone.zone_id,
+                )
+                for zone in filtered_zones
+            ]
             return DescribeAvailabilityZonesResult(AvailabilityZones=availability_zones)
-
         return call_moto(context)
 
     @handler("DescribeReservedInstancesOfferings", expand=False)


Test patch: