fix(ec2): list the DynamoDB gateway endpoint service in DescribeVpcEndpointServices (#9016)

* fix(ec2): list the DynamoDB gateway endpoint service in DescribeVpcEndpointServices
This commit is contained in:
Niels Kootstra authored and GitHub committed 2026-11-19 18:44:04 -04:00
1 parent b6af0646d5
commit a25c0435ee
6 files changed
+100 -18

No files matched your search

@@ -1977,6 +1977,9 @@ public class Ec2QueryHandler {
"elasticloadbalancing", "sns", "sqs", "kinesis-streams", "kinesis-firehose",
"states", "events", "lambda", "glue", "athena", "iot.data", "execute-api");
// The services AWS also offers as a Gateway endpoint, each named com.amazonaws.<region>.<name>.
private static final List<String> GATEWAY_ENDPOINT_SERVICES = List.of("s3", "dynamodb");
private Response handleDescribeVpcEndpointServices(MultivaluedMap<String, String> p, String region) {
List<String> requested = getList(p, "ServiceName");
List<Map.Entry<String, List<String>>> filters = getFiltersList(p);
@@ -2037,10 +2040,13 @@ public class Ec2QueryHandler {
private List<ServiceDetail> buildServiceDetails(String region, List<String> requested, List<String> azNames) {
List<ServiceDetail> services = new ArrayList<>();
// S3 is the one service with both offerings. The gateway keeps com.amazonaws in every
// partition; the interface takes the region's prefix, so in China the two are named apart.
String s3Gateway = "com.amazonaws." + region + ".s3";
String s3Interface = AwsRegionFacts.vpcEndpointServiceName(region, "s3");
// S3 and DynamoDB are the services with both offerings. The gateway keeps com.amazonaws in
// every partition; the interface takes the region's prefix, so in China S3's two are named apart.
Map<String, String> gatewayInterfaces = new LinkedHashMap<>();
for (String name : GATEWAY_ENDPOINT_SERVICES) {
gatewayInterfaces.put("com.amazonaws." + region + "." + name,
AwsRegionFacts.vpcEndpointServiceName(region, name));
}
// Requested service names are echoed verbatim, exactly as AWS does. The emulator
// supports any interface service in every AZ, so a requested (often custom) name
@@ -2053,22 +2059,23 @@ public class Ec2QueryHandler {
for (String name : INTERFACE_ENDPOINT_SERVICES) {
fullNames.add(AwsRegionFacts.vpcEndpointServiceName(region, name));
}
fullNames.add(s3Gateway);
if (!s3Interface.equals(s3Gateway)) {
fullNames.add(s3Interface);
for (Map.Entry<String, String> gateway : gatewayInterfaces.entrySet()) {
fullNames.add(gateway.getKey());
if (!gateway.getValue().equals(gateway.getKey())) {
fullNames.add(gateway.getValue());
}
}
}
for (String full : fullNames) {
List<String> serviceTypes;
if (full.equals(s3Interface) && !s3Interface.equals(s3Gateway)) {
String gatewayInterface = gatewayInterfaces.get(full);
if (gatewayInterface == null) {
serviceTypes = List.of("Interface");
} else if (full.endsWith(".s3")) {
serviceTypes = s3Interface.equals(s3Gateway)
? List.of("Gateway", "Interface")
: List.of("Gateway");
} else if (gatewayInterface.equals(full)) {
serviceTypes = List.of("Gateway", "Interface");
} else {
serviceTypes = List.of("Interface");
serviceTypes = List.of("Gateway");
}
services.add(new ServiceDetail(
full,
@@ -241,7 +241,8 @@ public class Ec2Service implements ContainerTeardown, ResourceProvider, Resettab
"execute-api", "*.execute-api",
"ecs-agent", "ecs-a",
"ecs-telemetry", "ecs-t",
"data.iot", "");
"data.iot", "",
"dynamodb", "");
// A first launch may need to pull a large AMI-backed image. Keep a finite CloudFormation
// bound, but allow enough time for that legitimate cold-start path before cancellation.
private static final Duration CONTAINER_LAUNCH_TIMEOUT = Duration.ofMinutes(5);