body) {
+ Instance inst = resolveInstance(ctx);
+ if (inst == null) {
+ return;
+ }
+ String value = instanceConnect == null ? null : body.apply(instanceConnect, inst);
+ if (value == null) {
+ ctx.response().setStatusCode(404).end("not-available");
+ return;
+ }
+ ctx.response().setStatusCode(200).putHeader("content-type", "text/plain");
+ if (ctx.request().method() == HttpMethod.HEAD) {
+ ctx.response().putHeader("content-length", String.valueOf(value.getBytes(StandardCharsets.UTF_8).length))
+ .end();
+ } else {
+ ctx.response().end(value);
+ }
+ }
+
private void handleMac(RoutingContext ctx) {
Instance inst = resolveInstance(ctx);
if (inst == null) {
diff --git a/src/main/java/io/floci/aws/services/ec2instanceconnect/InstanceConnectJsonHandler.java b/src/main/java/io/floci/aws/services/ec2instanceconnect/InstanceConnectJsonHandler.java
new file mode 100644
index 0000000000..9bd448c74b
--- /dev/null
+++ b/src/main/java/io/floci/aws/services/ec2instanceconnect/InstanceConnectJsonHandler.java
@@ -0,0 +1,162 @@
+package io.floci.aws.services.ec2instanceconnect;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import io.floci.aws.core.common.AwsException;
+import io.floci.aws.core.common.RegionResolver;
+import io.floci.aws.core.common.SshPublicKeys;
+import io.floci.aws.services.ec2.Ec2Service;
+import io.floci.aws.services.ec2.model.Instance;
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.inject.Inject;
+import jakarta.ws.rs.core.Response;
+
+import java.time.Clock;
+import java.util.Set;
+import java.util.UUID;
+import java.util.regex.Pattern;
+
+/**
+ * EC2 Instance Connect ({@code X-Amz-Target: AWSEC2InstanceConnectService.*}).
+ *
+ * {@code SendSSHPublicKey} validates the request against the service model and the instance's
+ * state, then hands the key to {@link InstanceConnectKeys}, which serves it signed to the
+ * instance's agent through IMDS for {@link InstanceConnectKeys#KEY_LIFETIME}. The serial console
+ * operation is answered with {@code SerialConsoleSessionUnsupportedException} once the instance is
+ * found: Docker-backed instances have no serial console.
+ */
+@ApplicationScoped
+public class InstanceConnectJsonHandler {
+
+ // Patterns and bounds from the service model (ec2-instance-connect 2018-04-02).
+ private static final Pattern INSTANCE_ID = Pattern.compile("^i-[a-f0-9]+$");
+ private static final Pattern OS_USER = Pattern.compile(
+ "(^[A-Za-z_][A-Za-z0-9@._-]{0,30}[A-Za-z0-9$_-]?$)"
+ + "|(^(?=.{2,32}$)[0-9]{1,32}[A-Za-z@._-][A-Za-z0-9@._-]*[A-Za-z0-9$_-]?$)");
+ private static final Pattern AVAILABILITY_ZONE = Pattern.compile("^(\\w+-){2,3}\\d+\\w+$");
+ /** The key types AWS documents for EC2 Instance Connect: RSA (2048 bits or more), ED25519 and ECDSA. */
+ private static final Set KEY_TYPES = Set.of("ssh-rsa", "ssh-ed25519",
+ "ecdsa-sha2-nistp256", "ecdsa-sha2-nistp384", "ecdsa-sha2-nistp521");
+ private static final int MIN_RSA_BITS = 2048;
+
+ private final Ec2Service ec2Service;
+ private final InstanceConnectKeys keys;
+ private final RegionResolver regionResolver;
+ private final ObjectMapper objectMapper;
+ private final Clock clock;
+
+ @Inject
+ public InstanceConnectJsonHandler(Ec2Service ec2Service, InstanceConnectKeys keys,
+ RegionResolver regionResolver, ObjectMapper objectMapper) {
+ this(ec2Service, keys, regionResolver, objectMapper, Clock.systemUTC());
+ }
+
+ InstanceConnectJsonHandler(Ec2Service ec2Service, InstanceConnectKeys keys, RegionResolver regionResolver,
+ ObjectMapper objectMapper, Clock clock) {
+ this.ec2Service = ec2Service;
+ this.keys = keys;
+ this.regionResolver = regionResolver;
+ this.objectMapper = objectMapper;
+ this.clock = clock;
+ }
+
+ public Response handle(String action, JsonNode request, String region) {
+ return switch (action) {
+ case "SendSSHPublicKey" -> sendSshPublicKey(request, region);
+ case "SendSerialConsoleSSHPublicKey" -> sendSerialConsoleSshPublicKey(request, region);
+ default -> throw new AwsException("UnknownOperationException",
+ "Operation " + action + " is not supported.", 400);
+ };
+ }
+
+ private Response sendSshPublicKey(JsonNode request, String region) {
+ String instanceId = required(request, "InstanceId");
+ String osUser = required(request, "InstanceOSUser");
+ String publicKey = required(request, "SSHPublicKey");
+ String zone = request.path("AvailabilityZone").asText(null);
+
+ if (instanceId.length() < 10 || instanceId.length() > 32 || !INSTANCE_ID.matcher(instanceId).matches()) {
+ throw invalid("Invalid instance ID: " + instanceId);
+ }
+ if (osUser.length() > 32 || !OS_USER.matcher(osUser).matches()) {
+ throw invalid("Invalid InstanceOSUser: " + osUser);
+ }
+ if (publicKey.length() < 80 || publicKey.length() > 4096) {
+ throw invalid("SSHPublicKey must be between 80 and 4096 characters long.");
+ }
+ if (publicKey.trim().chars().anyMatch(Character::isISOControl)) {
+ // The key is copied verbatim into the signed active-keys document, whose framing is
+ // line-based: an embedded newline would let one key forge lines for another.
+ throw invalid("SSHPublicKey must be a single line without control characters.");
+ }
+ validatePublicKey(publicKey.trim());
+ if (zone != null && (zone.length() < 6 || zone.length() > 32 || !AVAILABILITY_ZONE.matcher(zone).matches())) {
+ throw invalid("Invalid AvailabilityZone: " + zone);
+ }
+
+ Instance instance = ec2Service.getInstance(region, instanceId)
+ .orElseThrow(() -> new AwsException("EC2InstanceNotFoundException",
+ "Instance not found: " + instanceId, 400));
+ String instanceZone = instance.getPlacement() != null ? instance.getPlacement().getAvailabilityZone() : null;
+ if (zone != null && instanceZone != null && !zone.equals(instanceZone)) {
+ throw new AwsException("EC2InstanceNotFoundException",
+ "Instance not found in availability zone " + zone + ": " + instanceId, 400);
+ }
+ String state = instance.getState() != null ? instance.getState().getName() : null;
+ if (!"running".equals(state)) {
+ throw new AwsException("EC2InstanceStateInvalidException",
+ "Instance " + instanceId + " is not in a valid state for this operation: " + state, 400);
+ }
+
+ String requestId = UUID.randomUUID().toString();
+ String caller = regionResolver.buildGlobalArn("iam", "root");
+ keys.add(new InstanceConnectKeys.ActiveKey(instanceId, osUser, publicKey.trim(),
+ clock.instant().plus(InstanceConnectKeys.KEY_LIFETIME), caller, requestId));
+
+ ObjectNode response = objectMapper.createObjectNode();
+ response.put("RequestId", requestId);
+ response.put("Success", true);
+ return Response.ok(response).build();
+ }
+
+ /** Docker-backed instances have no serial console; AWS checks the instance exists before saying so. */
+ private Response sendSerialConsoleSshPublicKey(JsonNode request, String region) {
+ String instanceId = required(request, "InstanceId");
+ ec2Service.getInstance(region, instanceId)
+ .orElseThrow(() -> new AwsException("EC2InstanceNotFoundException",
+ "Instance not found: " + instanceId, 400));
+ throw new AwsException("SerialConsoleSessionUnsupportedException",
+ "The EC2 serial console is not supported for instance " + instanceId + ".", 400);
+ }
+
+ private static String required(JsonNode request, String field) {
+ JsonNode value = request.get(field);
+ if (value == null || value.isNull() || value.asText().isEmpty()) {
+ throw invalid(field + " is required.");
+ }
+ return value.asText();
+ }
+
+ /** One OpenSSH public key line: a supported type, its base64 blob carrying the same type, RSA of 2048 bits or more. */
+ static void validatePublicKey(String line) {
+ String[] parts = line.split("\\s+");
+ if (parts.length < 2 || !KEY_TYPES.contains(parts[0])) {
+ throw invalid("Unsupported or malformed SSH public key. Supported types: RSA, ED25519 and ECDSA.");
+ }
+ byte[] blob = SshPublicKeys.decodeBlob(line);
+ if (!SshPublicKeys.carriesAKey(blob)) {
+ throw invalid("Malformed SSH public key.");
+ }
+ if (!SshPublicKeys.keyType(blob).equals(parts[0])) {
+ throw invalid("The SSH public key's type does not match its encoded data.");
+ }
+ if ("ssh-rsa".equals(parts[0]) && SshPublicKeys.rsaKeyOf(blob).getModulus().bitLength() < MIN_RSA_BITS) {
+ throw invalid("RSA keys must be at least " + MIN_RSA_BITS + " bits long.");
+ }
+ }
+
+ private static AwsException invalid(String message) {
+ return new AwsException("InvalidArgsException", message, 400);
+ }
+}
diff --git a/src/main/java/io/floci/aws/services/ec2instanceconnect/InstanceConnectKeys.java b/src/main/java/io/floci/aws/services/ec2instanceconnect/InstanceConnectKeys.java
new file mode 100644
index 0000000000..3d0cf62177
--- /dev/null
+++ b/src/main/java/io/floci/aws/services/ec2instanceconnect/InstanceConnectKeys.java
@@ -0,0 +1,291 @@
+package io.floci.aws.services.ec2instanceconnect;
+
+import io.floci.aws.config.FlociCertificateAuthority;
+import io.floci.aws.core.common.AwsRegions;
+import io.floci.aws.core.common.Resettable;
+import io.floci.aws.services.acm.CertificateGenerator;
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.enterprise.inject.Instance;
+import jakarta.inject.Inject;
+import org.bouncycastle.asn1.x500.X500Name;
+import org.bouncycastle.cert.X509CertificateHolder;
+import org.bouncycastle.cert.jcajce.JcaX509CertificateHolder;
+import org.bouncycastle.cert.ocsp.BasicOCSPResp;
+import org.bouncycastle.cert.ocsp.BasicOCSPRespBuilder;
+import org.bouncycastle.cert.ocsp.CertificateID;
+import org.bouncycastle.cert.ocsp.CertificateStatus;
+import org.bouncycastle.cert.ocsp.OCSPResp;
+import org.bouncycastle.cert.ocsp.OCSPRespBuilder;
+import org.bouncycastle.cert.ocsp.jcajce.JcaBasicOCSPRespBuilder;
+import org.bouncycastle.operator.DigestCalculatorProvider;
+import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder;
+import org.bouncycastle.operator.jcajce.JcaDigestCalculatorProviderBuilder;
+
+import java.nio.charset.StandardCharsets;
+import java.security.KeyPair;
+import java.security.KeyPairGenerator;
+import java.security.MessageDigest;
+import java.security.PrivateKey;
+import java.security.Signature;
+import java.security.cert.X509Certificate;
+import java.security.interfaces.ECKey;
+import java.security.spec.MGF1ParameterSpec;
+import java.security.spec.PSSParameterSpec;
+import java.time.Clock;
+import java.time.Duration;
+import java.time.Instant;
+import java.time.temporal.ChronoUnit;
+import java.util.ArrayList;
+import java.util.Base64;
+import java.util.Date;
+import java.util.HexFormat;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.function.Supplier;
+
+/**
+ * The instance side of EC2 Instance Connect: the keys {@code SendSSHPublicKey} pushed, and the
+ * signing material the unmodified AWS agent ({@code aws-ec2-instance-connect-config}) verifies
+ * them with, served through IMDS under {@code managed-ssh-keys/}.
+ *
+ * The agent's contract, which this class exists to satisfy:
+ *
+ * - {@code signer-cert/} is a PEM chain: the signer first, then each issuer. The signer's CN
+ * must be {@code managed-ssh-signer..}, and the last certificate's CN must
+ * name a trusted file {@code /etc/ssl/certs/.pem}.
+ * - Every certificate below that trusted one needs an OCSP staple at
+ * {@code signer-ocsp/} (base64 DER), signed by its issuer,
+ * reporting {@code good}.
+ * - {@code active-keys//} holds one entry per key: {@code #Timestamp=} (expiry, epoch
+ * seconds), {@code #Instance=}, {@code #Caller=} and {@code #Request=} lines, the key line,
+ * then a base64 RSA-PSS (SHA-256, MGF1-SHA-256, salt 32) signature over those lines, and a
+ * blank line.
+ *
+ *
+ * The chain is signer, a Floci intermediate, and Floci's local CA, which Floci installs into
+ * each guest's trust store. On AWS the chain ends at a public root the AMI already trusts.
+ * Signing material lives in memory: a restart issues a new intermediate and signers under the
+ * same persistent root, so guests keep verifying.
+ */
+@ApplicationScoped
+public class InstanceConnectKeys implements Resettable {
+
+ /** AWS keeps a pushed key for 60 seconds. */
+ public static final Duration KEY_LIFETIME = Duration.ofSeconds(60);
+ static final String INTERMEDIATE_CN = "Floci EC2 Instance Connect Intermediate CA";
+ private static final Duration INTERMEDIATE_VALIDITY = Duration.ofDays(365);
+ private static final Duration SIGNER_VALIDITY = Duration.ofDays(30);
+ /** Material is reissued once it is this close to expiry, so a verification never races it. */
+ private static final Duration RENEW_BEFORE = Duration.ofDays(1);
+ private static final Duration STAPLE_VALIDITY = Duration.ofDays(7);
+
+ public record ActiveKey(String instanceId, String osUser, String publicKey, Instant expiresAt,
+ String caller, String requestId) {}
+
+ private record Issued(X509Certificate certificate, PrivateKey key) {}
+
+ private final Supplier rootCa;
+ private final CertificateGenerator generator;
+ private final Clock clock;
+ private final Map> keysByInstance = new ConcurrentHashMap<>();
+ private final Map signers = new ConcurrentHashMap<>();
+ private Issued intermediate;
+
+ @Inject
+ public InstanceConnectKeys(Instance rootCa,
+ CertificateGenerator generator) {
+ this(rootCa::get, generator, Clock.systemUTC());
+ }
+
+ InstanceConnectKeys(Supplier rootCa, CertificateGenerator generator, Clock clock) {
+ this.rootCa = rootCa;
+ this.generator = generator;
+ this.clock = clock;
+ }
+
+ // ── Keys ──────────────────────────────────────────────────────────────────
+
+ public void add(ActiveKey key) {
+ // Expired keys go here rather than on terminate: a key lives 60 seconds, so this bounds the
+ // map to instances that received one within the last minute.
+ keysByInstance.entrySet().removeIf(entry -> live(entry.getValue()).isEmpty());
+ keysByInstance.compute(key.instanceId(), (id, existing) -> {
+ List live = live(existing);
+ live.add(key);
+ return live;
+ });
+ }
+
+ /** The signed authorized-keys document for {@code osUser}, or empty when no key is live. */
+ public Optional activeKeysDocument(String region, String instanceId, String osUser) {
+ List forUser = live(keysByInstance.get(instanceId)).stream()
+ .filter(key -> key.osUser().equals(osUser))
+ .toList();
+ if (forUser.isEmpty()) {
+ return Optional.empty();
+ }
+ PrivateKey signingKey = signer(region).key();
+ StringBuilder document = new StringBuilder();
+ for (ActiveKey key : forUser) {
+ String signed = "#Timestamp=" + key.expiresAt().getEpochSecond() + "\n"
+ + "#Instance=" + key.instanceId() + "\n"
+ + "#Caller=" + key.caller() + "\n"
+ + "#Request=" + key.requestId() + "\n"
+ + key.publicKey().trim() + "\n";
+ document.append(signed).append(sign(signingKey, signed)).append("\n\n");
+ }
+ return Optional.of(document.toString());
+ }
+
+ int trackedInstanceCount() {
+ return keysByInstance.size();
+ }
+
+ private List live(List keys) {
+ Instant now = clock.instant();
+ List live = new ArrayList<>();
+ if (keys != null) {
+ keys.stream().filter(key -> key.expiresAt().isAfter(now)).forEach(live::add);
+ }
+ return live;
+ }
+
+ private static String sign(PrivateKey key, String data) {
+ try {
+ Signature signature = Signature.getInstance("RSASSA-PSS");
+ signature.setParameter(new PSSParameterSpec("SHA-256", "MGF1", MGF1ParameterSpec.SHA256, 32, 1));
+ signature.initSign(key);
+ signature.update(data.getBytes(StandardCharsets.UTF_8));
+ return Base64.getEncoder().encodeToString(signature.sign());
+ } catch (Exception e) {
+ throw new IllegalStateException("Failed to sign an EC2 Instance Connect key", e);
+ }
+ }
+
+ // ── Signing material ──────────────────────────────────────────────────────
+
+ /**
+ * The signer certificate, then the intermediate, then the root: what {@code signer-cert/} serves.
+ * Synchronized with {@link #signer} and {@link #intermediate} so a rotation between the two reads
+ * cannot mix generations.
+ */
+ public synchronized String signerCertificateChain(String region) {
+ try {
+ return generator.toPem(signer(region).certificate())
+ + generator.toPem(intermediate().certificate())
+ + rootCa.get().caPem();
+ } catch (Exception e) {
+ throw new IllegalStateException("Failed to encode the EC2 Instance Connect signer chain", e);
+ }
+ }
+
+ /** OCSP staples by upper-case SHA-1 fingerprint, each base64 DER: the signer's and the intermediate's. */
+ public synchronized Map ocspStaples(String region) {
+ Issued signer = signer(region);
+ Issued intermediate = intermediate();
+ FlociCertificateAuthority root = rootCa.get();
+ Map staples = new LinkedHashMap<>();
+ staples.put(sha1Fingerprint(signer.certificate()),
+ staple(signer.certificate(), intermediate.certificate(), intermediate.key()));
+ staples.put(sha1Fingerprint(intermediate.certificate()),
+ staple(intermediate.certificate(), root.certificate(), root.key()));
+ return staples;
+ }
+
+ /** The root guests must trust, and the file name the agent looks it up by. */
+ public String trustAnchorPem() {
+ return rootCa.get().caPem();
+ }
+
+ public String trustAnchorFileStem() {
+ String dn = rootCa.get().certificate().getSubjectX500Principal().getName();
+ String cn = dn.replaceFirst("(?s).*CN=([^,]+).*", "$1");
+ return cn.trim().replaceAll(" +", "_");
+ }
+
+ public static String signerCommonName(String region) {
+ return "managed-ssh-signer." + region + "." + AwsRegions.dnsSuffixFor(region);
+ }
+
+ private synchronized Issued intermediate() {
+ if (intermediate == null || expiresSoon(intermediate.certificate())) {
+ FlociCertificateAuthority root = rootCa.get();
+ intermediate = issue(INTERMEDIATE_CN, true,
+ X500Name.getInstance(root.certificate().getSubjectX500Principal().getEncoded()),
+ root.certificate(), root.key(), INTERMEDIATE_VALIDITY);
+ signers.clear();
+ }
+ return intermediate;
+ }
+
+ private synchronized Issued signer(String region) {
+ Issued issuer = intermediate();
+ Issued current = signers.get(region);
+ if (current == null || expiresSoon(current.certificate())) {
+ current = issue(signerCommonName(region), false,
+ X500Name.getInstance(issuer.certificate().getSubjectX500Principal().getEncoded()),
+ issuer.certificate(), issuer.key(), SIGNER_VALIDITY);
+ signers.put(region, current);
+ }
+ return current;
+ }
+
+ private boolean expiresSoon(X509Certificate certificate) {
+ return certificate.getNotAfter().toInstant().isBefore(clock.instant().plus(RENEW_BEFORE));
+ }
+
+ private Issued issue(String commonName, boolean asCa, X500Name issuerDn, X509Certificate issuerCert,
+ PrivateKey issuerKey, Duration validity) {
+ try {
+ KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA");
+ keyGen.initialize(2048);
+ KeyPair pair = keyGen.generateKeyPair();
+ Instant now = clock.instant();
+ X509Certificate cert = generator.signCertificate(new X500Name("CN=" + commonName), pair.getPublic(),
+ issuerDn, issuerKey, List.of(), asCa, null, now.minus(5, ChronoUnit.MINUTES),
+ now.plus(validity), issuerCert.getPublicKey());
+ return new Issued(cert, pair.getPrivate());
+ } catch (Exception e) {
+ throw new IllegalStateException("Failed to issue " + commonName, e);
+ }
+ }
+
+ private String staple(X509Certificate certificate, X509Certificate issuer, PrivateKey issuerKey) {
+ try {
+ DigestCalculatorProvider digests = new JcaDigestCalculatorProviderBuilder().build();
+ CertificateID id = new CertificateID(digests.get(CertificateID.HASH_SHA1),
+ new JcaX509CertificateHolder(issuer), certificate.getSerialNumber());
+ BasicOCSPRespBuilder builder = new JcaBasicOCSPRespBuilder(issuer.getPublicKey(),
+ digests.get(CertificateID.HASH_SHA1));
+ Instant now = clock.instant();
+ builder.addResponse(id, CertificateStatus.GOOD, Date.from(now.minus(5, ChronoUnit.MINUTES)),
+ Date.from(now.plus(STAPLE_VALIDITY)), null);
+ String algorithm = issuerKey instanceof ECKey ? "SHA256withECDSA" : "SHA256withRSA";
+ BasicOCSPResp basic = builder.build(new JcaContentSignerBuilder(algorithm).build(issuerKey),
+ new X509CertificateHolder[0], Date.from(now));
+ OCSPResp response = new OCSPRespBuilder().build(OCSPRespBuilder.SUCCESSFUL, basic);
+ return Base64.getEncoder().encodeToString(response.getEncoded());
+ } catch (Exception e) {
+ throw new IllegalStateException("Failed to staple " + certificate.getSubjectX500Principal(), e);
+ }
+ }
+
+ static String sha1Fingerprint(X509Certificate certificate) {
+ try {
+ return HexFormat.of().withUpperCase()
+ .formatHex(MessageDigest.getInstance("SHA-1").digest(certificate.getEncoded()));
+ } catch (Exception e) {
+ throw new IllegalStateException("Cannot fingerprint " + certificate.getSubjectX500Principal(), e);
+ }
+ }
+
+ @Override
+ public synchronized void clear() {
+ keysByInstance.clear();
+ signers.clear();
+ intermediate = null;
+ }
+}
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index a14a1b4aaa..d5b25fffb5 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -1018,6 +1018,8 @@ floci:
enabled: true
efs:
enabled: true
+ ec2instanceconnect:
+ enabled: true
organizations:
enabled: true
# management-account-email: "" # When set, overrides the management-account email reported by DescribeOrganization and account listings.
diff --git a/src/main/resources/aws/iam-request-resources.json b/src/main/resources/aws/iam-request-resources.json
index 90ffc4641b..decbe1fd27 100644
--- a/src/main/resources/aws/iam-request-resources.json
+++ b/src/main/resources/aws/iam-request-resources.json
@@ -1,10 +1,10 @@
{
- "_source": {"generator": "tools/aws/regen_iam_request_resources.py", "reference": "https://servicereference.us-east-1.amazonaws.com/", "botocore": "botocore 1.43.118 (installed package)", "retrieved": "2026-11-06", "note": "make iam-request-resources-check re-derives every operation's resources from botocore; make iam-request-resources-verify checks every action, type and format against AWS."},
+ "_source": {"generator": "tools/aws/regen_iam_request_resources.py", "reference": "https://servicereference.us-east-1.amazonaws.com/", "botocore": "botocore 1.43.118 (installed package)", "retrieved": "2026-11-07", "note": "make iam-request-resources-check re-derives every operation's resources from botocore; make iam-request-resources-verify checks every action, type and format against AWS."},
"namespaces": {"access-analyzer": ["accessanalyzer"], "acm": ["acm"], "application-autoscaling": ["application-autoscaling"], "athena": ["athena"], "bcm-data-exports": ["bcm-data-exports"], "bcm-pricing-calculator": ["bcm-pricing-calculator"], "budgets": ["budgets"], "ce": ["ce"], "cloudtrail": ["cloudtrail"], "codebuild": ["codebuild"], "codepipeline": ["codepipeline"], "cognito-identity": ["cognito-identity"], "cognito-idp": ["cognito-idp"], "cur": ["cur"], "datasync": ["datasync"], "dynamodb": ["dynamodb"], "ecr": ["ecr"], "elasticloadbalancing": ["elb", "elbv2"], "elasticmapreduce": ["emr"], "es": ["es", "opensearch"], "events": ["eventbridgev2", "events"], "firehose": ["firehose"], "globalaccelerator": ["globalaccelerator"], "kinesisanalytics": ["kinesisanalyticsv2"], "logs": ["logs"], "payment-cryptography": ["payment-cryptography", "payment-cryptography-data"], "quicksight": ["quicksight"], "redshift": ["redshift"], "redshift-data": ["redshift-data"], "rekognition": ["rekognition"], "servicediscovery": ["servicediscovery"], "servicequotas": ["service-quotas"], "sso": ["sso", "sso-admin"], "states": ["stepfunctions"], "textract": ["textract"], "timestream-influxdb": ["timestream-influxdb"], "translate": ["translate"]},
"clientsNotRead": {"kinesisanalytics": "Kinesis Data Analytics v1, SQL applications on the KinesisAnalytics_20150814 target, which Floci does not serve (it serves v2, kinesisanalyticsv2); its operations share v2's names and name their resources by other members"},
"handBuilt": ["apigateway", "bedrock", "dsql", "dynamodb", "eks", "iam", "kinesis", "kms", "lambda", "logs", "pipes", "resource-groups", "s3", "scheduler", "secretsmanager", "sns", "sqs", "ssm", "sts"],
- "notCovered": {"account": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "airflow": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "app-integrations": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "appconfig": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "appsync": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "aps": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "autoscaling": "not read yet: AWS's group and launch configuration ARNs carry an id the service mints, `autoScalingGroup::autoScalingGroupName/`, while Floci mints `autoScalingGroup:`, which other services (ECS capacity providers) read back; the mint is fixed first", "aws-marketplace": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "backup": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "batch": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "bedrock-agentcore": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "cloudformation": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "cloudfront": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "cloudhsm": "not read yet: its ARN formats end in ${CloudHsmClusterInstanceName} and ${CloudHsmBackupInstanceName}, names, while its requests give ClusterId and BackupId, ids, which the rule does not fill a name from, so nearly every operation needs a correction", "cloudwatch": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "codeartifact": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "codedeploy": "not read yet: the Service Reference gives an on-premises instance's ARN as `instance:${InstanceName}`, while the CodeDeploy permissions reference gives arn:aws:codedeploy:region:account-id:instance/instance-ID and AWS's GetOnPremisesInstance example answers instance/_, an id the service mints after the name; reading it needs that format corrected", "codeguru-reviewer": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "comprehend": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "config": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "connect": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "controlcatalog": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "controltower": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "detective": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "dlm": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "dms": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "ec2": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "ecs": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "elasticache": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "elasticbeanstalk": "not read yet: an environment's ARN carries its application's name, `environment//`, while most of its requests name it by EnvironmentName or EnvironmentId alone, so reading it needs the stored environment those find", "elasticfilesystem": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "emr-serverless": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "execute-api": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "fis": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "glue": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "guardduty": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "identitystore": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "inspector2": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "iot": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "kafka": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "lightsail": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "macie2": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "memorydb": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "mq": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "network-firewall": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "oam": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "organizations": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "ram": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "rds": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "rds-data": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "redshift-serverless": "not read yet: its namespace, workgroup, snapshot and managed VPC endpoint ARNs end in an id the service mints, `namespace/`, while its requests name them by namespaceName, workgroupName, snapshotName and endpointName, so reading it needs the stored ARNs those find, as Redshift Data's workgroups are found", "resource-explorer-2": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "route53": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "route53resolver": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "rum": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "s3tables": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "s3vectors": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "sagemaker": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "securityhub": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "servicecatalog": "not read yet: CreatePortfolioShare, UpdatePortfolioShare and DeletePortfolioShare give in AccountId the account a portfolio is shared with, which the rule reads as the portfolio's; a portfolio or product imported from another account keeps its owner's account in its ARN while requests name it by its id alone; and AppRegistry's applications and attribute groups are named in the path", "ses": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "signin": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "sso-oauth": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "swf": "not read yet: the Service Reference gives a domain's ARN no Region, `swf:::/domain/`, while the SWF Developer Guide gives it as arn:aws:swf:Region:AccountID:/domain/DomainName, as Floci mints it; reading it needs that format corrected", "transcribe": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "transfer": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "verifiedpermissions": "not read yet: a policyStoreId may name its store by an alias, `policy-store-alias/`, which AWS authorizes as the action on the store the alias points to and GetPolicyStoreAlias on the alias, and an aliasName carries the `policy-store-alias/` its format already gives; reading it needs both", "wafv2": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint"},
- "otherNamespaces": ["a4b", "account-access", "acm-pca", "aco-automation", "agent-registry", "aidevops", "aiops", "airflow-serverless", "amplify", "amplifybackend", "amplifyuibuilder", "aoss", "appfabric", "appflow", "application-signals", "application-signals-mcp", "appmesh", "appmesh-preview", "apprunner", "appstream", "apptest", "arc-region-switch", "arc-zonal-shift", "artifact", "assurance", "auditmanager", "aws-external-anthropic", "b2bi", "backup-gateway", "backup-search", "bedrock-mantle", "bedrock-websearch", "billing", "billingconductor", "braket", "bugbust", "cases", "cassandra", "chatbot", "chime", "cleanrooms", "cleanrooms-ml", "cloud9", "clouddirectory", "cloudfront-keyvaluestore", "cloudsearch", "cloudshell", "cloudtrail-data", "codecatalyst", "codecommit", "codeconnections", "codeguru-profiler", "codeguru-security", "codestar-connections", "codestar-notifications", "codewhisperer", "cognito-sync", "connect-campaigns", "consoleapp", "continuum", "databrew", "dataexchange", "datapipeline", "datazone", "dax", "deadline", "devicefarm", "devops-guru", "directconnect", "docdb-elastic", "drs", "ds", "ds-data", "ebs", "ec2-instance-connect", "ecr-public", "eks-auth", "elastictranscoder", "elemental-appliances-software", "elemental-inference", "elemental-support-cases", "emr-containers", "end-user-messaging", "entityresolution", "evs", "finspace", "finspace-api", "fms", "forecast", "frauddetector", "freertos", "fsx", "gamelift", "gameliftstreams", "geo", "geo-maps", "geo-places", "geo-routes", "glacier", "grafana", "greengrass", "groundstation", "health", "health-agent", "healthlake", "honeycode", "identity-sync", "imagebuilder", "interconnect", "internetmonitor", "invoicing", "iotanalytics", "iotdeviceadvisor", "iotfleethub", "iotfleetwise", "iotjobsdata", "iotmanagedintegrations", "iotsitewise", "iottwinmaker", "iotwireless", "iq", "iq-permission", "ivs", "ivschat", "kafka-cluster", "kafkaconnect", "kendra", "kendra-ranking", "kinesisvideo", "launchwizard", "lex", "license-manager", "license-manager-linux-subscriptions", "license-manager-user-subscriptions", "lookoutequipment", "lookoutmetrics", "lookoutvision", "m2", "machinelearning", "managedblockchain", "mapcredits", "mediaconnect", "mediaconvert", "medialive", "mediapackage", "mediapackage-vod", "mediapackagev2", "mediastore", "mediatailor", "medical-imaging", "mgh", "mgn", "migrationhub-orchestrator", "mobiletargeting", "monitron", "mpa", "neptune-db", "neptune-graph", "network-security-manager", "networkflowmonitor", "networkmanager", "networkmonitor", "nimble", "notifications", "notifications-contacts", "nova-act", "observabilityadmin", "odb", "omics", "one", "opensearch", "opsworks", "osis", "outposts", "panorama", "partnercentral", "payments", "pca-connector-ad", "pca-connector-scep", "pcs", "personalize", "pi", "polly", "private-networks", "profile", "proton", "purchase-orders", "q", "qapps", "qbusiness", "qdeveloper", "qldb", "rbin", "rds-db", "refactor-spaces", "repostspace", "resiliencehub", "robomaker", "rolesanywhere", "route53-recovery-cluster", "route53-recovery-control-config", "route53-recovery-readiness", "route53globalresolver", "route53profiles", "rtbfabric", "s3-object-lambda", "s3-outposts", "s3express", "s3files", "sagemaker-geospatial", "sagemaker-mlflow", "savingsplans", "schemas", "scn", "sdb", "security-ir", "securityagent", "securitylake", "serverlessrepo", "shield", "signer", "simspaceweaver", "sms-voice", "snow-device-management", "social-messaging", "sqlworkbench", "ssm-contacts", "ssm-incidents", "ssm-quicksetup", "ssm-sap", "ssmmessages", "storagegateway", "supportauthz", "synthetics", "thinclient", "timestream", "tnb", "transform", "transform-custom", "trustedadvisor", "ts", "vendor-insights", "voiceid", "vpc-lattice", "vpc-lattice-svcs", "vpce", "waf", "waf-regional", "wellarchitected", "wickr", "wisdom", "workdocs", "worklink", "workmail", "workmailmessageflow", "workspaces", "workspaces-instances", "workspaces-web", "xray"],
+ "notCovered": {"account": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "airflow": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "app-integrations": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "appconfig": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "appsync": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "aps": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "autoscaling": "not read yet: AWS's group and launch configuration ARNs carry an id the service mints, `autoScalingGroup::autoScalingGroupName/`, while Floci mints `autoScalingGroup:`, which other services (ECS capacity providers) read back; the mint is fixed first", "aws-marketplace": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "backup": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "batch": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "bedrock-agentcore": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "cloudformation": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "cloudfront": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "cloudhsm": "not read yet: its ARN formats end in ${CloudHsmClusterInstanceName} and ${CloudHsmBackupInstanceName}, names, while its requests give ClusterId and BackupId, ids, which the rule does not fill a name from, so nearly every operation needs a correction", "cloudwatch": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "codeartifact": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "codedeploy": "not read yet: the Service Reference gives an on-premises instance's ARN as `instance:${InstanceName}`, while the CodeDeploy permissions reference gives arn:aws:codedeploy:region:account-id:instance/instance-ID and AWS's GetOnPremisesInstance example answers instance/_, an id the service mints after the name; reading it needs that format corrected", "codeguru-reviewer": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "comprehend": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "config": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "connect": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "controlcatalog": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "controltower": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "detective": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "dlm": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "dms": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "ec2": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "ec2-instance-connect": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "ecs": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "elasticache": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "elasticbeanstalk": "not read yet: an environment's ARN carries its application's name, `environment//`, while most of its requests name it by EnvironmentName or EnvironmentId alone, so reading it needs the stored environment those find", "elasticfilesystem": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "emr-serverless": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "execute-api": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "fis": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "glue": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "guardduty": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "identitystore": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "inspector2": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "iot": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "kafka": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "lightsail": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "macie2": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "memorydb": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "mq": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "network-firewall": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "oam": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "organizations": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "ram": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "rds": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "rds-data": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "redshift-serverless": "not read yet: its namespace, workgroup, snapshot and managed VPC endpoint ARNs end in an id the service mints, `namespace/`, while its requests name them by namespaceName, workgroupName, snapshotName and endpointName, so reading it needs the stored ARNs those find, as Redshift Data's workgroups are found", "resource-explorer-2": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "route53": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "route53resolver": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "rum": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "s3tables": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "s3vectors": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "sagemaker": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "securityhub": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "servicecatalog": "not read yet: CreatePortfolioShare, UpdatePortfolioShare and DeletePortfolioShare give in AccountId the account a portfolio is shared with, which the rule reads as the portfolio's; a portfolio or product imported from another account keeps its owner's account in its ARN while requests name it by its id alone; and AppRegistry's applications and attribute groups are named in the path", "ses": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "signin": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "sso-oauth": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "swf": "not read yet: the Service Reference gives a domain's ARN no Region, `swf:::/domain/`, while the SWF Developer Guide gives it as arn:aws:swf:Region:AccountID:/domain/DomainName, as Floci mints it; reading it needs that format corrected", "transcribe": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "transfer": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "verifiedpermissions": "not read yet: a policyStoreId may name its store by an alias, `policy-store-alias/`, which AWS authorizes as the action on the store the alias points to and GetPolicyStoreAlias on the alias, and an aliasName carries the `policy-store-alias/` its format already gives; reading it needs both", "wafv2": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint"},
+ "otherNamespaces": ["a4b", "account-access", "acm-pca", "aco-automation", "agent-registry", "aidevops", "aiops", "airflow-serverless", "amplify", "amplifybackend", "amplifyuibuilder", "aoss", "appfabric", "appflow", "application-signals", "application-signals-mcp", "appmesh", "appmesh-preview", "apprunner", "appstream", "apptest", "arc-region-switch", "arc-zonal-shift", "artifact", "assurance", "auditmanager", "aws-external-anthropic", "b2bi", "backup-gateway", "backup-search", "bedrock-mantle", "bedrock-websearch", "billing", "billingconductor", "braket", "bugbust", "cases", "cassandra", "chatbot", "chime", "cleanrooms", "cleanrooms-ml", "cloud9", "clouddirectory", "cloudfront-keyvaluestore", "cloudsearch", "cloudshell", "cloudtrail-data", "codecatalyst", "codecommit", "codeconnections", "codeguru-profiler", "codeguru-security", "codestar-connections", "codestar-notifications", "codewhisperer", "cognito-sync", "connect-campaigns", "consoleapp", "continuum", "databrew", "dataexchange", "datapipeline", "datazone", "dax", "deadline", "devicefarm", "devops-guru", "directconnect", "docdb-elastic", "drs", "ds", "ds-data", "ebs", "ecr-public", "eks-auth", "elastictranscoder", "elemental-appliances-software", "elemental-inference", "elemental-support-cases", "emr-containers", "end-user-messaging", "entityresolution", "evs", "finspace", "finspace-api", "fms", "forecast", "frauddetector", "freertos", "fsx", "gamelift", "gameliftstreams", "geo", "geo-maps", "geo-places", "geo-routes", "glacier", "grafana", "greengrass", "groundstation", "health", "health-agent", "healthlake", "honeycode", "identity-sync", "imagebuilder", "interconnect", "internetmonitor", "invoicing", "iotanalytics", "iotdeviceadvisor", "iotfleethub", "iotfleetwise", "iotjobsdata", "iotmanagedintegrations", "iotsitewise", "iottwinmaker", "iotwireless", "iq", "iq-permission", "ivs", "ivschat", "kafka-cluster", "kafkaconnect", "kendra", "kendra-ranking", "kinesisvideo", "launchwizard", "lex", "license-manager", "license-manager-linux-subscriptions", "license-manager-user-subscriptions", "lookoutequipment", "lookoutmetrics", "lookoutvision", "m2", "machinelearning", "managedblockchain", "mapcredits", "mediaconnect", "mediaconvert", "medialive", "mediapackage", "mediapackage-vod", "mediapackagev2", "mediastore", "mediatailor", "medical-imaging", "mgh", "mgn", "migrationhub-orchestrator", "mobiletargeting", "monitron", "mpa", "neptune-db", "neptune-graph", "network-security-manager", "networkflowmonitor", "networkmanager", "networkmonitor", "nimble", "notifications", "notifications-contacts", "nova-act", "observabilityadmin", "odb", "omics", "one", "opensearch", "opsworks", "osis", "outposts", "panorama", "partnercentral", "payments", "pca-connector-ad", "pca-connector-scep", "pcs", "personalize", "pi", "polly", "private-networks", "profile", "proton", "purchase-orders", "q", "qapps", "qbusiness", "qdeveloper", "qldb", "rbin", "rds-db", "refactor-spaces", "repostspace", "resiliencehub", "robomaker", "rolesanywhere", "route53-recovery-cluster", "route53-recovery-control-config", "route53-recovery-readiness", "route53globalresolver", "route53profiles", "rtbfabric", "s3-object-lambda", "s3-outposts", "s3express", "s3files", "sagemaker-geospatial", "sagemaker-mlflow", "savingsplans", "schemas", "scn", "sdb", "security-ir", "securityagent", "securitylake", "serverlessrepo", "shield", "signer", "simspaceweaver", "sms-voice", "snow-device-management", "social-messaging", "sqlworkbench", "ssm-contacts", "ssm-incidents", "ssm-quicksetup", "ssm-sap", "ssmmessages", "storagegateway", "supportauthz", "synthetics", "thinclient", "timestream", "tnb", "transform", "transform-custom", "trustedadvisor", "ts", "vendor-insights", "voiceid", "vpc-lattice", "vpc-lattice-svcs", "vpce", "waf", "waf-regional", "wellarchitected", "wickr", "wisdom", "workdocs", "worklink", "workmail", "workmailmessageflow", "workspaces", "workspaces-instances", "workspaces-web", "xray"],
"arnFormats": {"access-analyzer": {"Analyzer": "arn:${Partition}:access-analyzer:${Region}:${Account}:analyzer/${AnalyzerName}", "ArchiveRule": "arn:${Partition}:access-analyzer:${Region}:${Account}:analyzer/${AnalyzerName}/archive-rule/${RuleName}"}, "acm": {"acme-domain-validation": "arn:${Partition}:acm:${Region}:${Account}:acme-endpoint/${AcmeEndpointId}/acme-domain-validation/${AcmeDomainValidationId}", "acme-endpoint": "arn:${Partition}:acm:${Region}:${Account}:acme-endpoint/${AcmeEndpointId}", "acme-external-account-binding": "arn:${Partition}:acm:${Region}:${Account}:acme-endpoint/${AcmeEndpointId}/acme-external-account-binding/${ExternalAccountBindingId}", "certificate": "arn:${Partition}:acm:${Region}:${Account}:certificate/${CertificateId}"}, "application-autoscaling": {"ScalableTarget": "arn:${Partition}:application-autoscaling:${Region}:${Account}:scalable-target/${ResourceId}"}, "athena": {"capacity-reservation": "arn:${Partition}:athena:${Region}:${Account}:capacity-reservation/${CapacityReservationName}", "datacatalog": "arn:${Partition}:athena:${Region}:${Account}:datacatalog/${DataCatalogName}", "session": "arn:${Partition}:athena:${Region}:${Account}:workgroup/${WorkGroupName}/session/${SessionId}", "system-table": "arn:${Partition}:athena:${Region}:${Account}:system-table/${TableName}", "workgroup": "arn:${Partition}:athena:${Region}:${Account}:workgroup/${WorkGroupName}"}, "bcm-data-exports": {"billingview": "arn:${Partition}:billing::${Account}:billingview/${ResourceId}", "export": "arn:${Partition}:bcm-data-exports:${Region}:${Account}:export/${Identifier}", "table": "arn:${Partition}:bcm-data-exports:${Region}:${Account}:table/${Identifier}"}, "bcm-pricing-calculator": {"bill-estimate": "arn:${Partition}:bcm-pricing-calculator::${Account}:bill-estimate/${BillEstimateId}", "bill-scenario": "arn:${Partition}:bcm-pricing-calculator::${Account}:bill-scenario/${BillScenarioId}", "workload-estimate": "arn:${Partition}:bcm-pricing-calculator::${Account}:workload-estimate/${WorkloadEstimateId}"}, "budgets": {"budget": "arn:${Partition}:budgets::${Account}:budget/${BudgetName}", "budgetAction": "arn:${Partition}:budgets::${Account}:budget/${BudgetName}/action/${ActionId}"}, "ce": {"anomalymonitor": "arn:${Partition}:ce::${Account}:anomalymonitor/${Identifier}", "anomalysubscription": "arn:${Partition}:ce::${Account}:anomalysubscription/${Identifier}", "billingview": "arn:${Partition}:billing::${Account}:billingview/${ResourceId}", "costcategory": "arn:${Partition}:ce::${Account}:costcategory/${Identifier}"}, "cloudtrail": {"channel": "arn:${Partition}:cloudtrail:${Region}:${Account}:channel/${ChannelId}", "dashboard": "arn:${Partition}:cloudtrail:${Region}:${Account}:dashboard/${DashboardName}", "eventdatastore": "arn:${Partition}:cloudtrail:${Region}:${Account}:eventdatastore/${EventDataStoreId}", "trail": "arn:${Partition}:cloudtrail:${Region}:${Account}:trail/${TrailName}"}, "codebuild": {"build": "arn:${Partition}:codebuild:${Region}:${Account}:build/${BuildId}", "build-batch": "arn:${Partition}:codebuild:${Region}:${Account}:build-batch/${BuildBatchId}", "fleet": "arn:${Partition}:codebuild:${Region}:${Account}:fleet/${FleetName}:${FleetId}", "project": "arn:${Partition}:codebuild:${Region}:${Account}:project/${ProjectName}", "report": "arn:${Partition}:codebuild:${Region}:${Account}:report/${ReportGroupName}:${ReportId}", "report-group": "arn:${Partition}:codebuild:${Region}:${Account}:report-group/${ReportGroupName}", "sandbox": "arn:${Partition}:codebuild:${Region}:${Account}:sandbox/${SandboxId}"}, "codepipeline": {"action": "arn:${Partition}:codepipeline:${Region}:${Account}:${PipelineName}/${StageName}/${ActionName}", "actiontype": "arn:${Partition}:codepipeline:${Region}:${Account}:actiontype:${Owner}/${Category}/${Provider}/${Version}", "pipeline": "arn:${Partition}:codepipeline:${Region}:${Account}:${PipelineName}", "stage": "arn:${Partition}:codepipeline:${Region}:${Account}:${PipelineName}/${StageName}", "webhook": "arn:${Partition}:codepipeline:${Region}:${Account}:webhook:${WebhookName}"}, "cognito-identity": {"identitypool": "arn:${Partition}:cognito-identity:${Region}:${Account}:identitypool/${IdentityPoolId}"}, "cognito-idp": {"userpool": "arn:${Partition}:cognito-idp:${Region}:${Account}:userpool/${UserPoolId}", "webacl": "arn:${Partition}:wafv2:${Region}:${Account}:${Scope}/webacl/${Name}/${Id}"}, "cur": {"cur": "arn:${Partition}:cur:${Region}:${Account}:definition/${ReportName}"}, "datasync": {"agent": "arn:${Partition}:datasync:${Region}:${Account}:agent/${AgentId}", "discoveryjob": "arn:${Partition}:datasync:${Region}:${Account}:system/${StorageSystemId}/job/${DiscoveryJobId}", "location": "arn:${Partition}:datasync:${Region}:${Account}:location/${LocationId}", "storagesystem": "arn:${Partition}:datasync:${Region}:${Account}:system/${StorageSystemId}", "task": "arn:${Partition}:datasync:${Region}:${Account}:task/${TaskId}", "taskexecution": "arn:${Partition}:datasync:${Region}:${Account}:task/${TaskId}/execution/${ExecutionId}"}, "dynamodb": {"backup": "arn:${Partition}:dynamodb:${Region}:${Account}:table/${TableName}/backup/${BackupName}", "bulk-operation": "arn:${Partition}:dynamodb:${Region}:${Account}:bulk-operation/${BulkOperationId}", "export": "arn:${Partition}:dynamodb:${Region}:${Account}:table/${TableName}/export/${ExportName}", "global-table": "arn:${Partition}:dynamodb::${Account}:global-table/${GlobalTableName}", "import": "arn:${Partition}:dynamodb:${Region}:${Account}:table/${TableName}/import/${ImportName}", "index": "arn:${Partition}:dynamodb:${Region}:${Account}:table/${TableName}/index/${IndexName}", "stream": "arn:${Partition}:dynamodb:${Region}:${Account}:table/${TableName}/stream/${StreamLabel}", "table": "arn:${Partition}:dynamodb:${Region}:${Account}:table/${TableName}"}, "ecr": {"repository": "arn:${Partition}:ecr:${Region}:${Account}:repository/${RepositoryName}"}, "elasticloadbalancing": {"listener-rule/app": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:listener-rule/app/${LoadBalancerName}/${LoadBalancerId}/${ListenerId}/${ListenerRuleId}", "listener-rule/net": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:listener-rule/net/${LoadBalancerName}/${LoadBalancerId}/${ListenerId}/${ListenerRuleId}", "listener/app": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:listener/app/${LoadBalancerName}/${LoadBalancerId}/${ListenerId}", "listener/gwy": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:listener/gwy/${LoadBalancerName}/${LoadBalancerId}/${ListenerId}", "listener/net": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:listener/net/${LoadBalancerName}/${LoadBalancerId}/${ListenerId}", "loadbalancer": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:loadbalancer/${LoadBalancerName}", "loadbalancer/app/": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:loadbalancer/app/${LoadBalancerName}/${LoadBalancerId}", "loadbalancer/gwy/": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:loadbalancer/gwy/${LoadBalancerName}/${LoadBalancerId}", "loadbalancer/net/": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:loadbalancer/net/${LoadBalancerName}/${LoadBalancerId}", "targetgroup": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:targetgroup/${TargetGroupName}/${TargetGroupId}", "truststore": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:truststore/${TrustStoreName}/${TrustStoreId}"}, "elasticmapreduce": {"cluster": "arn:${Partition}:elasticmapreduce:${Region}:${Account}:cluster/${ClusterId}", "editor": "arn:${Partition}:elasticmapreduce:${Region}:${Account}:editor/${EditorId}", "notebook-execution": "arn:${Partition}:elasticmapreduce:${Region}:${Account}:notebook-execution/${NotebookExecutionId}", "session": "arn:${Partition}:elasticmapreduce:${Region}:${Account}:cluster/${ClusterId}/session/${SessionId}", "studio": "arn:${Partition}:elasticmapreduce:${Region}:${Account}:studio/${StudioId}"}, "es": {"application": "arn:${Partition}:opensearch:${Region}:${Account}:application/${AppId}", "datasource": "arn:${Partition}:opensearch:${Region}:${Account}:datasource/${DataSourceName}", "domain": "arn:${Partition}:es:${Region}:${Account}:domain/${DomainName}", "es_role": "arn:${Partition}:iam::${Account}:role/aws-service-role/es.amazonaws.com/AWSServiceRoleForAmazonOpenSearchService", "opensearchservice_role": "arn:${Partition}:iam::${Account}:role/aws-service-role/opensearchservice.amazonaws.com/AWSServiceRoleForAmazonOpenSearchService"}, "events": {"alias": "arn:${Partition}:kms:${Region}:${Account}:alias/${Alias}", "api-destination": "arn:${Partition}:events:${Region}:${Account}:api-destination/${ApiDestinationName}", "archive": "arn:${Partition}:events:${Region}:${Account}:archive/${ArchiveName}", "connection": "arn:${Partition}:events:${Region}:${Account}:connection/${ConnectionName}", "create-snapshot": "arn:${Partition}:events:${Region}:${Account}:target/create-snapshot", "endpoint": "arn:${Partition}:events:${Region}:${Account}:endpoint/${EndpointName}", "event-bus": "arn:${Partition}:events:${Region}:${Account}:event-bus/${EventBusName}", "event-busv2": "arn:${Partition}:events:${Region}:${Account}:event-busv2/${EventBusName}/${OpaqueId}", "event-source": "arn:${Partition}:events:${Region}::event-source/${EventSourceName}", "event-sourcev2": "arn:${Partition}:events:${Region}:${Account}:event-sourcev2/${SourceType}/${EventSourceName}/${OpaqueId}", "key": "arn:${Partition}:kms:${Region}:${Account}:key/${KeyId}", "reboot-instance": "arn:${Partition}:events:${Region}:${Account}:target/reboot-instance", "replay": "arn:${Partition}:events:${Region}:${Account}:replay/${ReplayName}", "rule-on-custom-event-bus": "arn:${Partition}:events:${Region}:${Account}:rule/${EventBusName}/${RuleName}", "rule-on-default-event-bus": "arn:${Partition}:events:${Region}:${Account}:rule/${RuleName}", "stop-instance": "arn:${Partition}:events:${Region}:${Account}:target/stop-instance", "subscriber": "arn:${Partition}:events:${Region}:${Account}:subscriber/${SubscriberName}/${OpaqueId}", "terminate-instance": "arn:${Partition}:events:${Region}:${Account}:target/terminate-instance"}, "firehose": {"deliverystream": "arn:${Partition}:firehose:${Region}:${Account}:deliverystream/${DeliveryStreamName}"}, "globalaccelerator": {"accelerator": "arn:${Partition}:globalaccelerator::${Account}:accelerator/${ResourceId}", "attachment": "arn:${Partition}:globalaccelerator::${Account}:attachment/${ResourceId}", "endpointgroup": "arn:${Partition}:globalaccelerator::${Account}:accelerator/${ResourceId}/listener/${ListenerId}/endpoint-group/${EndpointGroupId}", "listener": "arn:${Partition}:globalaccelerator::${Account}:accelerator/${ResourceId}/listener/${ListenerId}"}, "kinesisanalytics": {"application": "arn:${Partition}:kinesisanalytics:${Region}:${Account}:application/${ApplicationName}"}, "logs": {"anomaly-detector": "arn:${Partition}:logs:${Region}:${Account}:anomaly-detector:${DetectorId}", "delivery": "arn:${Partition}:logs:${Region}:${Account}:delivery:${DeliveryName}", "delivery-destination": "arn:${Partition}:logs:${Region}:${Account}:delivery-destination:${DeliveryDestinationName}", "delivery-source": "arn:${Partition}:logs:${Region}:${Account}:delivery-source:${DeliverySourceName}", "destination": "arn:${Partition}:logs:${Region}:${Account}:destination:${DestinationName}", "log-group": "arn:${Partition}:logs:${Region}:${Account}:log-group:${LogGroupName}", "log-stream": "arn:${Partition}:logs:${Region}:${Account}:log-group:${LogGroupName}:log-stream:${LogStreamName}", "lookup-table": "arn:${Partition}:logs:${Region}:${Account}:lookup-table:${LookupTableName}", "scheduled-query": "arn:${Partition}:logs:${Region}:${Account}:scheduled-query:${ScheduledQueryId}"}, "payment-cryptography": {"alias": "arn:${Partition}:payment-cryptography:${Region}:${Account}:alias/${Alias}", "approval-team": "arn:${Partition}:mpa:${Region}:${Account}:approval-team/${ApprovalTeamId}", "key": "arn:${Partition}:payment-cryptography:${Region}:${Account}:key/${KeyId}"}, "quicksight": {"accessControlApplication": "arn:${Partition}:quicksight:${Region}:${Account}:access-control-application/${ResourceId}", "account": "arn:${Partition}:quicksight:${Region}:${Account}:account/${ResourceId}", "actionconnector": "arn:${Partition}:quicksight:${Region}:${Account}:action-connector/${ResourceId}", "agent": "arn:${Partition}:quicksight:${Region}:${Account}:agent/${ResourceId}", "analysis": "arn:${Partition}:quicksight:${Region}:${Account}:analysis/${ResourceId}", "app": "arn:${Partition}:quicksight:${Region}:${Account}:app/${ResourceId}", "approvalPolicy": "arn:${Partition}:quicksight:${Region}:${Account}:approval-policy/${ResourceId}", "assetBundleExportJob": "arn:${Partition}:quicksight:${Region}:${Account}:asset-bundle-export-job/${ResourceId}", "assetBundleImportJob": "arn:${Partition}:quicksight:${Region}:${Account}:asset-bundle-import-job/${ResourceId}", "assignment": "arn:${Partition}:quicksight::${Account}:assignment/${ResourceId}", "automation": "arn:${Partition}:quicksight:${Region}:${Account}:automation-group/${AutomationGroupId}/automation/${ResourceId}", "automationGroup": "arn:${Partition}:quicksight:${Region}:${Account}:automation-group/${ResourceId}", "automationJob": "arn:${Partition}:quicksight:${Region}:${Account}:automation-group/${AutomationGroupId}/automation/${AutomationId}/job/${ResourceId}", "brand": "arn:${Partition}:quicksight:${Region}:${Account}:brand/${ResourceId}", "customization": "arn:${Partition}:quicksight:${Region}:${Account}:customization/${ResourceId}", "custompermissions": "arn:${Partition}:quicksight:${Region}:${Account}:custompermissions/${ResourceId}", "dashboard": "arn:${Partition}:quicksight:${Region}:${Account}:dashboard/${ResourceId}", "dashboardSnapshotJob": "arn:${Partition}:quicksight:${Region}:${Account}:dashboard/${DashboardId}/snapshot-job/${ResourceId}", "dataset": "arn:${Partition}:quicksight:${Region}:${Account}:dataset/${ResourceId}", "datasource": "arn:${Partition}:quicksight:${Region}:${Account}:datasource/${ResourceId}", "dlpSetting": "arn:${Partition}:quicksight:${Region}:${Account}:dlpsetting/${ResourceId}", "emailCustomizationTemplate": "arn:${Partition}:quicksight:${Region}:${Account}:email-customization-template/${ResourceId}", "extension": "arn:${Partition}:quicksight:${Region}:${Account}:extension/${ResourceId}", "extensionaccess": "arn:${Partition}:quicksight:${Region}:${Account}:extension-access/${ResourceId}", "flow": "arn:${Partition}:quicksight:${Region}:${Account}:flow/${ResourceId}", "folder": "arn:${Partition}:quicksight:${Region}:${Account}:folder/${ResourceId}", "group": "arn:${Partition}:quicksight:${Region}:${Account}:group/${ResourceId}", "inboundConnector": "arn:${Partition}:quicksight:${Region}:${Account}:inbound-connector/${ResourceId}", "ingestion": "arn:${Partition}:quicksight:${Region}:${Account}:dataset/${DatasetId}/ingestion/${ResourceId}", "knowledgeBase": "arn:${Partition}:quicksight:${Region}:${Account}:knowledge-base/${ResourceId}", "limitsProfile": "arn:${Partition}:quicksight:${Region}:${Account}:limits-profile/${ResourceId}", "namespace": "arn:${Partition}:quicksight:${Region}:${Account}:namespace/${ResourceId}", "oauthClientApplication": "arn:${Partition}:quicksight:${Region}:${Account}:oauthClientApplication/${ResourceId}", "refreshschedule": "arn:${Partition}:quicksight:${Region}:${Account}:dataset/${DatasetId}/refresh-schedule/${ResourceId}", "space": "arn:${Partition}:quicksight:${Region}:${Account}:space/${ResourceId}", "template": "arn:${Partition}:quicksight:${Region}:${Account}:template/${ResourceId}", "theme": "arn:${Partition}:quicksight:${Region}:${Account}:theme/${ResourceId}", "topic": "arn:${Partition}:quicksight:${Region}:${Account}:topic/${ResourceId}", "user": "arn:${Partition}:quicksight:${Region}:${Account}:user/${ResourceId}", "vpcconnection": "arn:${Partition}:quicksight:${Region}:${Account}:vpcConnection/${ResourceId}"}, "redshift": {"cluster": "arn:${Partition}:redshift:${Region}:${Account}:cluster:${ClusterName}", "datashare": "arn:${Partition}:redshift:${Region}:${Account}:datashare:${ProducerClusterNamespace}/${DataShareName}", "dbgroup": "arn:${Partition}:redshift:${Region}:${Account}:dbgroup:${ClusterName}/${DbGroup}", "dbname": "arn:${Partition}:redshift:${Region}:${Account}:dbname:${ClusterName}/${DbName}", "dbuser": "arn:${Partition}:redshift:${Region}:${Account}:dbuser:${ClusterName}/${DbUser}", "eventsubscription": "arn:${Partition}:redshift:${Region}:${Account}:eventsubscription:${EventSubscriptionName}", "hsmclientcertificate": "arn:${Partition}:redshift:${Region}:${Account}:hsmclientcertificate:${HSMClientCertificateId}", "hsmconfiguration": "arn:${Partition}:redshift:${Region}:${Account}:hsmconfiguration:${HSMConfigurationId}", "integration": "arn:${Partition}:redshift:${Region}:${Account}:integration:${IntegrationIdentifier}", "namespace": "arn:${Partition}:redshift:${Region}:${Account}:namespace:${ClusterNamespace}", "parametergroup": "arn:${Partition}:redshift:${Region}:${Account}:parametergroup:${ParameterGroupName}", "qev2idcapplication": "arn:${Partition}:redshift:${Region}:${Account}:qev2idcapplication:${Qev2IdcApplicationId}", "redshiftidcapplication": "arn:${Partition}:redshift:${Region}:${Account}:redshiftidcapplication:${RedshiftIdcApplicationId}", "securitygroup": "arn:${Partition}:redshift:${Region}:${Account}:securitygroup:${SecurityGroupName}/ec2securitygroup/${Owner}/${Ec2SecurityGroupId}", "securitygroupingress-cidr": "arn:${Partition}:redshift:${Region}:${Account}:securitygroupingress:${SecurityGroupName}/cidrip/${IpRange}", "securitygroupingress-ec2securitygroup": "arn:${Partition}:redshift:${Region}:${Account}:securitygroupingress:${SecurityGroupName}/ec2securitygroup/${Owner}/${Ece2SecuritygroupId}", "snapshot": "arn:${Partition}:redshift:${Region}:${Account}:snapshot:${ClusterName}/${SnapshotName}", "snapshotcopygrant": "arn:${Partition}:redshift:${Region}:${Account}:snapshotcopygrant:${SnapshotCopyGrantName}", "snapshotschedule": "arn:${Partition}:redshift:${Region}:${Account}:snapshotschedule:${ScheduleIdentifier}", "subnetgroup": "arn:${Partition}:redshift:${Region}:${Account}:subnetgroup:${SubnetGroupName}", "usagelimit": "arn:${Partition}:redshift:${Region}:${Account}:usagelimit:${UsageLimitId}"}, "redshift-data": {"cluster": "arn:${Partition}:redshift:${Region}:${Account}:cluster:${ClusterName}", "managed-workgroup": "arn:${Partition}:redshift-serverless:${Region}:${Account}:managed-workgroup/${ManagedWorkgroupId}", "workgroup": "arn:${Partition}:redshift-serverless:${Region}:${Account}:workgroup/${WorkgroupId}"}, "rekognition": {"collection": "arn:${Partition}:rekognition:${Region}:${Account}:collection/${CollectionId}", "dataset": "arn:${Partition}:rekognition:${Region}:${Account}:project/${ProjectName}/dataset/${DatasetType}/${CreationTimestamp}", "project": "arn:${Partition}:rekognition:${Region}:${Account}:project/${ProjectName}/${CreationTimestamp}", "projectversion": "arn:${Partition}:rekognition:${Region}:${Account}:project/${ProjectName}/version/${VersionName}/${CreationTimestamp}", "streamprocessor": "arn:${Partition}:rekognition:${Region}:${Account}:streamprocessor/${StreamprocessorId}"}, "servicediscovery": {"namespace": "arn:${Partition}:servicediscovery:${Region}:${Account}:namespace/${NamespaceId}", "service": "arn:${Partition}:servicediscovery:${Region}:${Account}:service/${ServiceId}"}, "servicequotas": {"quota": "arn:${Partition}:servicequotas:${Region}:${Account}:${ServiceCode}/${QuotaCode}"}, "sso": {"Account": "arn:${Partition}:sso:::account/${AccountId}", "Application": "arn:${Partition}:sso::${Account}:application/${InstanceId}/${ApplicationId}", "ApplicationProvider": "arn:${Partition}:sso::aws:applicationProvider/${ApplicationProviderId}", "Instance": "arn:${Partition}:sso:::instance/${InstanceId}", "PermissionSet": "arn:${Partition}:sso:::permissionSet/${InstanceId}/${PermissionSetId}", "TrustedTokenIssuer": "arn:${Partition}:sso::${Account}:trustedTokenIssuer/${InstanceId}/${TrustedTokenIssuerId}"}, "states": {"activity": "arn:${Partition}:states:${Region}:${Account}:activity:${ActivityName}", "execution": "arn:${Partition}:states:${Region}:${Account}:execution:${StateMachineName}:${ExecutionId}", "express": "arn:${Partition}:states:${Region}:${Account}:express:${StateMachineName}:${ExecutionId}:${ExpressId}", "labelled execution": "arn:${Partition}:states:${Region}:${Account}:execution:${StateMachineName}/${MapRunLabel}:${ExecutionId}", "labelled express": "arn:${Partition}:states:${Region}:${Account}:express:${StateMachineName}/${MapRunLabel}:${ExecutionId}:${ExpressId}", "maprun": "arn:${Partition}:states:${Region}:${Account}:mapRun:${StateMachineName}/${MapRunLabel}:${MapRunId}", "statemachine": "arn:${Partition}:states:${Region}:${Account}:stateMachine:${StateMachineName}", "statemachinealias": "arn:${Partition}:states:${Region}:${Account}:stateMachine:${StateMachineName}:${StateMachineAliasName}", "statemachineversion": "arn:${Partition}:states:${Region}:${Account}:stateMachine:${StateMachineName}:${StateMachineVersionId}"}, "textract": {"adapter": "arn:${Partition}:textract:${Region}:${Account}:/adapters/${AdapterId}", "adapterversion": "arn:${Partition}:textract:${Region}:${Account}:/adapters/${AdapterId}/versions/${AdapterVersion}"}, "timestream-influxdb": {"db-backup": "arn:${Partition}:timestream-influxdb:${Region}:${Account}:db-backup/${DbBackupId}", "db-cluster": "arn:${Partition}:timestream-influxdb:${Region}:${Account}:db-cluster/${DbClusterId}", "db-instance": "arn:${Partition}:timestream-influxdb:${Region}:${Account}:db-instance/${DbInstanceIdentifier}", "db-parameter-group": "arn:${Partition}:timestream-influxdb:${Region}:${Account}:db-parameter-group/${DbParameterGroupIdentifier}"}, "translate": {"parallel-data": "arn:${Partition}:translate:${Region}:${Account}:parallel-data/${ResourceName}", "terminology": "arn:${Partition}:translate:${Region}:${Account}:terminology/${ResourceName}"}},
"unqualified": {"states": ["statemachine"]},
"mintedIds": {"events": ["api-destination", "connection"]},
diff --git a/src/test/java/io/floci/aws/core/common/InstanceConnectEnablementIntegrationTest.java b/src/test/java/io/floci/aws/core/common/InstanceConnectEnablementIntegrationTest.java
new file mode 100644
index 0000000000..a9a83a489f
--- /dev/null
+++ b/src/test/java/io/floci/aws/core/common/InstanceConnectEnablementIntegrationTest.java
@@ -0,0 +1,34 @@
+package io.floci.aws.core.common;
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.TestProfile;
+import jakarta.inject.Inject;
+import org.junit.jupiter.api.Test;
+
+import java.util.Map;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/** EC2 Instance Connect has its own enabled flag; turning it off leaves EC2 on. */
+@QuarkusTest
+@TestProfile(InstanceConnectEnablementIntegrationTest.InstanceConnectDisabledProfile.class)
+class InstanceConnectEnablementIntegrationTest {
+
+ @Inject
+ ServiceRegistry serviceRegistry;
+
+ @Test
+ void ownFlagDisablesOnlyInstanceConnect() {
+ assertFalse(serviceRegistry.isServiceEnabled("ec2-instance-connect"));
+ assertTrue(serviceRegistry.isServiceEnabled("ec2"));
+ }
+
+ public static final class InstanceConnectDisabledProfile implements QuarkusTestProfile {
+ @Override
+ public Map getConfigOverrides() {
+ return Map.of("floci.services.ec2instanceconnect.enabled", "false");
+ }
+ }
+}
diff --git a/src/test/java/io/floci/aws/core/common/PartitionCrossServiceSmokeIntegrationTest.java b/src/test/java/io/floci/aws/core/common/PartitionCrossServiceSmokeIntegrationTest.java
index 01521e31e0..d38de979cc 100644
--- a/src/test/java/io/floci/aws/core/common/PartitionCrossServiceSmokeIntegrationTest.java
+++ b/src/test/java/io/floci/aws/core/common/PartitionCrossServiceSmokeIntegrationTest.java
@@ -2,10 +2,12 @@ package io.floci.aws.core.common;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.cbor.CBORFactory;
+import io.floci.aws.services.ec2instanceconnect.InstanceConnectKeys;
import io.floci.aws.testing.PartitionCleanup;
import io.floci.aws.testing.PartitionMatrix;
import io.floci.aws.testing.PartitionMatrix.PartitionCase;
import io.floci.aws.testing.RestAssuredJsonUtils;
+import io.quarkus.arc.Arc;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.path.json.config.JsonPathConfig;
import io.restassured.response.Response;
@@ -45,7 +47,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
"aps", "autoscaling", "backup", "batch", "bcmdataexports", "bedrock", "bedrockagentcorecontrol", "ce",
"cloudfront", "cloudmap", "cloudwatch", "codebuild", "codedeploy", "codepipeline", "cognito",
"configservice", "connect", "controlcatalog", "controltower", "datasync", "dlm", "dms", "dsql", "dynamodb", "ec2",
- "ecr", "ecs", "efs", "eks", "elasticache", "elasticbeanstalk", "elb", "elbv2", "emr", "emrserverless",
+ "ec2instanceconnect", "ecr", "ecs", "efs", "eks", "elasticache", "elasticbeanstalk", "elb", "elbv2", "emr", "emrserverless",
"eventbridge", "eventbridgev2", "firehose", "fis", "glue", "guardduty", "iot", "kinesis", "kinesisanalytics", "lambda",
"lambdamicrovms", "lambdaweb", "memorydb", "msk", "mwaa", "networkfirewall", "oam", "opensearch", "organizations",
"paymentcryptography", "pipes", "quicksight", "ram", "rds", "redshift", "redshiftserverless",
@@ -534,6 +536,51 @@ class PartitionCrossServiceSmokeIntegrationTest {
PartitionMatrix.assertGlobalArnIn(partitionCase, created.xmlPath().getString("CreateIpamResponse.ipam.ipamArn"));
}
+ /**
+ * SendSSHPublicKey answers only RequestId and Success; the caller ARN it mints is read back
+ * from the signed active-keys document IMDS would serve the instance, and the signer host from
+ * the name its certificate is issued under.
+ */
+ @ParameterizedTest
+ @MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
+ void instanceConnectCallerArnAndSignerHost(PartitionCase partitionCase) {
+ String region = offered(partitionCase, "ec2-instance-connect");
+ String instanceId = signed(region, "ec2")
+ .formParam("Action", "RunInstances")
+ .formParam("Version", "2016-11-15")
+ .formParam("ImageId", "ami-0123456789abcdef0")
+ .formParam("InstanceType", "t3.micro")
+ .formParam("MinCount", "1")
+ .formParam("MaxCount", "1")
+ .when().post("/").then().statusCode(200)
+ .extract().xmlPath().getString("RunInstancesResponse.instancesSet.item.instanceId");
+ cleanup.register(() -> signed(region, "ec2")
+ .formParam("Action", "TerminateInstances")
+ .formParam("Version", "2016-11-15")
+ .formParam("InstanceId.1", instanceId)
+ .when().post("/"));
+ // A mock launch settles on the next describe, as it does for any other caller.
+ String state = signed(region, "ec2")
+ .formParam("Action", "DescribeInstances")
+ .formParam("Version", "2016-11-15")
+ .formParam("InstanceId.1", instanceId)
+ .when().post("/").then().statusCode(200).extract().xmlPath()
+ .getString("DescribeInstancesResponse.reservationSet.item.instancesSet.item.instanceState.name");
+ assertEquals("running", state);
+
+ json11(region, "ec2-instance-connect", "AWSEC2InstanceConnectService.SendSSHPublicKey",
+ "{\"InstanceId\":\"" + instanceId + "\",\"InstanceOSUser\":\"admin\",\"SSHPublicKey\":\""
+ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl smoke\"}")
+ .when().post("/").then().statusCode(200);
+
+ String document = Arc.container().instance(InstanceConnectKeys.class).get()
+ .activeKeysDocument(region, instanceId, "admin").orElseThrow();
+ String caller = document.lines().filter(line -> line.startsWith("#Caller="))
+ .findFirst().orElseThrow().substring("#Caller=".length());
+ PartitionMatrix.assertGlobalArnIn(partitionCase, caller);
+ assertRegionalHostIn(partitionCase, InstanceConnectKeys.signerCommonName(region));
+ }
+
@ParameterizedTest
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void apiGatewayDomainNameArn(PartitionCase partitionCase) {
diff --git a/src/test/java/io/floci/aws/services/ec2/Ec2ContainerManagerTest.java b/src/test/java/io/floci/aws/services/ec2/Ec2ContainerManagerTest.java
index 8982e518bf..8032fba7d9 100644
--- a/src/test/java/io/floci/aws/services/ec2/Ec2ContainerManagerTest.java
+++ b/src/test/java/io/floci/aws/services/ec2/Ec2ContainerManagerTest.java
@@ -43,6 +43,7 @@ import io.floci.aws.services.ec2.model.InstanceNetworkInterface;
import io.floci.aws.services.ec2.model.InstanceState;
import io.floci.aws.services.ec2.net.VpcNetworkManager;
import io.floci.aws.services.ec2.portforward.Ec2PortForwardManager;
+import io.floci.aws.services.ec2instanceconnect.InstanceConnectKeys;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
@@ -300,7 +301,7 @@ class Ec2ContainerManagerTest {
networks.put(second, new ContainerNetwork().withIpv4Address(sharedFirst ? "10.0.1.10" : "192.0.2.10"));
when(settings.getNetworks()).thenReturn(networks);
when(command.exec()).thenReturn(response);
- Ec2MetadataServer server = new Ec2MetadataServer(null, null, null);
+ Ec2MetadataServer server = new Ec2MetadataServer(null, null, null, (InstanceConnectKeys) null);
Ec2ContainerManager manager = managerWith(lifecycle, docker, server);
Instance guest = instance("i-multinetwork");
guest.setDockerContainerId(TEST_CONTAINER_ID);
diff --git a/src/test/java/io/floci/aws/services/ec2/Ec2MetadataInstanceConnectTest.java b/src/test/java/io/floci/aws/services/ec2/Ec2MetadataInstanceConnectTest.java
new file mode 100644
index 0000000000..1c147a84d9
--- /dev/null
+++ b/src/test/java/io/floci/aws/services/ec2/Ec2MetadataInstanceConnectTest.java
@@ -0,0 +1,91 @@
+package io.floci.aws.services.ec2;
+
+import io.floci.aws.services.ec2instanceconnect.InstanceConnectKeys;
+import io.vertx.core.Context;
+import org.junit.jupiter.api.Test;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Optional;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+/**
+ * The IMDS paths the unmodified EC2 Instance Connect agent reads, in the shape it reads them:
+ * with a trailing slash, and {@code active-keys} probed with HEAD before it is fetched.
+ */
+class Ec2MetadataInstanceConnectTest {
+
+ @Test
+ void servesTheAgentsPathsWithTrailingSlashesAndHead() throws Exception {
+ InstanceConnectKeys keys = mock(InstanceConnectKeys.class);
+ when(keys.activeKeysDocument(anyString(), eq("i-0123456789abcdef0"), anyString())).thenReturn(Optional.empty());
+ when(keys.activeKeysDocument(anyString(), eq("i-0123456789abcdef0"), eq("admin")))
+ .thenReturn(Optional.of("#Timestamp=1\nssh-ed25519 AAAA\nc2ln\n\n"));
+ when(keys.signerCertificateChain(anyString())).thenReturn("CHAIN");
+ Map staples = new LinkedHashMap<>();
+ staples.put("AA11", "c3RhcGxlMQ==");
+ staples.put("BB22", "c3RhcGxlMg==");
+ when(keys.ocspStaples(anyString())).thenReturn(staples);
+
+ try (Ec2MetadataTestFixture imds = new Ec2MetadataTestFixture().withInstanceConnect(keys)) {
+ imds.instance().setRegion("us-east-1");
+ imds.start();
+ String token = imds.putToken("60").body();
+ String keysPath = "/latest/meta-data/managed-ssh-keys/";
+
+ assertEquals("i-0123456789abcdef0", imds.get("/latest/meta-data/instance-id/", token).body());
+ assertEquals("amazonaws.com", imds.get("/latest/meta-data/services/domain/", token).body());
+ assertEquals(200, imds.head(keysPath + "active-keys/admin/", token).statusCode());
+ assertEquals(404, imds.head(keysPath + "active-keys/root/", token).statusCode());
+ assertEquals("#Timestamp=1\nssh-ed25519 AAAA\nc2ln\n\n",
+ imds.get(keysPath + "active-keys/admin/", token).body());
+ assertEquals("CHAIN", imds.get(keysPath + "signer-cert/", token).body());
+ assertEquals("AA11\nBB22", imds.get(keysPath + "signer-ocsp/", token).body());
+ assertEquals("c3RhcGxlMg==", imds.get(keysPath + "signer-ocsp/BB22", token).body());
+ assertEquals(404, imds.get(keysPath + "signer-ocsp/CC33", token).statusCode());
+ }
+ }
+
+ @Test
+ void keyGenerationAndSigningRunOffTheEventLoop() throws Exception {
+ AtomicBoolean onEventLoop = new AtomicBoolean();
+ InstanceConnectKeys keys = mock(InstanceConnectKeys.class);
+ when(keys.signerCertificateChain(anyString())).thenAnswer(inv -> {
+ onEventLoop.set(Context.isOnEventLoopThread());
+ return "CHAIN";
+ });
+ try (Ec2MetadataTestFixture imds = new Ec2MetadataTestFixture().withInstanceConnect(keys)) {
+ imds.instance().setRegion("us-east-1");
+ imds.start();
+ String token = imds.putToken("60").body();
+ assertEquals("CHAIN", imds.get("/latest/meta-data/managed-ssh-keys/signer-cert", token).body());
+ assertFalse(onEventLoop.get(), "signing must not run on the Vert.x event loop");
+ }
+ }
+
+ @Test
+ void servicesDomainIsTheInstanceRegionsPartitionDomain() throws Exception {
+ try (Ec2MetadataTestFixture imds = new Ec2MetadataTestFixture()) {
+ imds.instance().setRegion("cn-north-1");
+ imds.start();
+ String token = imds.putToken("60").body();
+ assertEquals("amazonaws.com.cn", imds.get("/latest/meta-data/services/domain", token).body());
+ }
+ }
+
+ @Test
+ void managedSshKeysAreAbsentWithoutInstanceConnect() throws Exception {
+ try (Ec2MetadataTestFixture imds = new Ec2MetadataTestFixture()) {
+ imds.start();
+ String token = imds.putToken("60").body();
+ assertEquals(404, imds.get("/latest/meta-data/managed-ssh-keys/signer-cert/", token).statusCode());
+ }
+ }
+}
diff --git a/src/test/java/io/floci/aws/services/ec2/Ec2MetadataServerTest.java b/src/test/java/io/floci/aws/services/ec2/Ec2MetadataServerTest.java
index 9eeff94ecb..522b55ad1a 100644
--- a/src/test/java/io/floci/aws/services/ec2/Ec2MetadataServerTest.java
+++ b/src/test/java/io/floci/aws/services/ec2/Ec2MetadataServerTest.java
@@ -3,6 +3,7 @@ package io.floci.aws.services.ec2;
import io.floci.aws.services.ec2.model.Instance;
import io.floci.aws.services.ec2.model.Placement;
import io.floci.aws.services.ec2.model.Tag;
+import io.floci.aws.services.ec2instanceconnect.InstanceConnectKeys;
import org.junit.jupiter.api.Test;
import java.util.List;
@@ -15,7 +16,7 @@ class Ec2MetadataServerTest {
@Test
void reconciliationAndTerminationPreserveOtherInstances() {
- Ec2MetadataServer server = new Ec2MetadataServer(null, null, null);
+ Ec2MetadataServer server = new Ec2MetadataServer(null, null, null, (InstanceConnectKeys) null);
Instance first = new Instance();
first.setInstanceId("i-first");
Instance second = new Instance();
@@ -100,7 +101,7 @@ class Ec2MetadataServerTest {
@Test
void staleContainerUnregisterDoesNotRemoveCurrentRegistration() {
- Ec2MetadataServer server = new Ec2MetadataServer(null, null, null);
+ Ec2MetadataServer server = new Ec2MetadataServer(null, null, null, (InstanceConnectKeys) null);
Instance oldInstance = new Instance();
oldInstance.setInstanceId("i-old");
Instance currentInstance = new Instance();
diff --git a/src/test/java/io/floci/aws/services/ec2/Ec2MetadataTestFixture.java b/src/test/java/io/floci/aws/services/ec2/Ec2MetadataTestFixture.java
index c220efc6eb..43babc83d3 100644
--- a/src/test/java/io/floci/aws/services/ec2/Ec2MetadataTestFixture.java
+++ b/src/test/java/io/floci/aws/services/ec2/Ec2MetadataTestFixture.java
@@ -2,6 +2,7 @@ package io.floci.aws.services.ec2;
import io.floci.aws.config.EmulatorConfig;
import io.floci.aws.services.ec2.model.Instance;
+import io.floci.aws.services.ec2instanceconnect.InstanceConnectKeys;
import io.floci.aws.services.iam.IamService;
import io.floci.aws.testing.MutableClock;
import io.floci.aws.testutil.FreePorts;
@@ -34,6 +35,7 @@ final class Ec2MetadataTestFixture implements AutoCloseable {
private final Instance instance = instance("i-0123456789abcdef0");
private Vertx vertx;
private Ec2MetadataServer server;
+ private InstanceConnectKeys instanceConnect;
private String endpoint;
void start() throws Exception {
@@ -53,7 +55,7 @@ final class Ec2MetadataTestFixture implements AutoCloseable {
int port = FreePorts.anyInterfacePort();
when(config.services().ec2().imdsPort()).thenReturn(port);
vertx = Vertx.vertx();
- server = new Ec2MetadataServer(vertx, config, iam, serverClock);
+ server = new Ec2MetadataServer(vertx, config, iam, serverClock, instanceConnect);
server.start().get(10, TimeUnit.SECONDS);
endpoint = "http://127.0.0.1:" + port;
if (registeredInstance != null) {
@@ -76,6 +78,18 @@ final class Ec2MetadataTestFixture implements AutoCloseable {
}
}
+ /** Serves EC2 Instance Connect from {@code keys}; call before {@link #start()}. */
+ Ec2MetadataTestFixture withInstanceConnect(InstanceConnectKeys keys) {
+ this.instanceConnect = keys;
+ return this;
+ }
+
+ HttpResponse head(String path, String token) throws Exception {
+ return client.send(HttpRequest.newBuilder(URI.create(endpoint + path)).timeout(Duration.ofSeconds(5))
+ .header(TOKEN_HEADER, token).method("HEAD", HttpRequest.BodyPublishers.noBody()).build(),
+ HttpResponse.BodyHandlers.ofString());
+ }
+
MutableClock clock() {
return clock;
}
diff --git a/src/test/java/io/floci/aws/services/ec2instanceconnect/InstanceConnectIntegrationTest.java b/src/test/java/io/floci/aws/services/ec2instanceconnect/InstanceConnectIntegrationTest.java
new file mode 100644
index 0000000000..4c4792b20f
--- /dev/null
+++ b/src/test/java/io/floci/aws/services/ec2instanceconnect/InstanceConnectIntegrationTest.java
@@ -0,0 +1,66 @@
+package io.floci.aws.services.ec2instanceconnect;
+
+import io.floci.aws.testing.RestAssuredJsonUtils;
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.response.Response;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import static io.floci.aws.testing.Ec2Requests.ec2;
+import static io.restassured.RestAssured.given;
+import static org.hamcrest.Matchers.emptyString;
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.not;
+
+@QuarkusTest
+class InstanceConnectIntegrationTest {
+
+ private static final String JSON_1_1 = "application/x-amz-json-1.1";
+ private static final String ED25519 =
+ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl user@host";
+
+ @BeforeAll
+ static void configureRestAssured() {
+ RestAssuredJsonUtils.configureAwsContentTypes();
+ }
+
+ private static Response send(String instanceId, String key) {
+ return given()
+ .header("X-Amz-Target", "AWSEC2InstanceConnectService.SendSSHPublicKey")
+ .contentType(JSON_1_1)
+ .body("{\"InstanceId\":\"" + instanceId + "\",\"InstanceOSUser\":\"ec2-user\",\"SSHPublicKey\":\""
+ + key + "\"}")
+ .post("/");
+ }
+
+ @Test
+ void sendsAKeyToARunningInstanceAndRejectsWhatAwsRejects() {
+ String instanceId = ec2("RunInstances", "000000000000", "us-east-1")
+ .formParam("ImageId", "ami-0abcdef1234567890")
+ .formParam("InstanceType", "t3.micro")
+ .formParam("MinCount", "1").formParam("MaxCount", "1")
+ .post("/").then().statusCode(200)
+ .extract().path("RunInstancesResponse.instancesSet.item.instanceId");
+ try {
+ // Mock mode settles a launch on the first DescribeInstances; the key needs a running instance.
+ ec2("DescribeInstances", "000000000000", "us-east-1").formParam("InstanceId.1", instanceId)
+ .post("/").then().statusCode(200)
+ .body("DescribeInstancesResponse.reservationSet.item.instancesSet.item.instanceState.name",
+ equalTo("running"));
+ send(instanceId, ED25519).then().statusCode(200)
+ .body("Success", equalTo(true))
+ .body("RequestId", not(emptyString()));
+ send(instanceId, "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5 " + "c".repeat(80)).then().statusCode(400)
+ .body("__type", equalTo("InvalidArgsException"));
+ } finally {
+ ec2("TerminateInstances", "000000000000", "us-east-1").formParam("InstanceId.1", instanceId)
+ .post("/").then().statusCode(200);
+ }
+ }
+
+ @Test
+ void unknownInstanceIsAModeledError() {
+ send("i-0000000000000000f", ED25519).then().statusCode(400)
+ .body("__type", equalTo("EC2InstanceNotFoundException"));
+ }
+}
diff --git a/src/test/java/io/floci/aws/services/ec2instanceconnect/InstanceConnectJsonHandlerTest.java b/src/test/java/io/floci/aws/services/ec2instanceconnect/InstanceConnectJsonHandlerTest.java
new file mode 100644
index 0000000000..515cbf2e4d
--- /dev/null
+++ b/src/test/java/io/floci/aws/services/ec2instanceconnect/InstanceConnectJsonHandlerTest.java
@@ -0,0 +1,189 @@
+package io.floci.aws.services.ec2instanceconnect;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import io.floci.aws.core.common.AwsException;
+import io.floci.aws.core.common.RegionResolver;
+import io.floci.aws.services.ec2.Ec2Service;
+import io.floci.aws.services.ec2.model.Instance;
+import io.floci.aws.services.ec2.model.InstanceState;
+import jakarta.ws.rs.core.Response;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.mockito.ArgumentCaptor;
+
+import java.math.BigInteger;
+import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
+import java.time.Clock;
+import java.time.Instant;
+import java.time.ZoneOffset;
+import java.util.Base64;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Optional;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+class InstanceConnectJsonHandlerTest {
+
+ private static final String REGION = "us-east-1";
+ private static final String INSTANCE = "i-0123456789abcdef0";
+ private static final Instant NOW = Instant.parse("2026-10-16T12:00:00Z");
+ private static final String ED25519 =
+ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl user@host";
+
+ private final ObjectMapper mapper = new ObjectMapper();
+ private Ec2Service ec2;
+ private InstanceConnectKeys keys;
+ private InstanceConnectJsonHandler handler;
+ private Instance instance;
+
+ @BeforeEach
+ void setUp() {
+ ec2 = mock(Ec2Service.class);
+ keys = mock(InstanceConnectKeys.class);
+ handler = handlerIn("us-east-1");
+ instance = new Instance();
+ instance.setInstanceId(INSTANCE);
+ instance.setState(InstanceState.running());
+ when(ec2.getInstance(REGION, INSTANCE)).thenReturn(Optional.of(instance));
+ }
+
+ @Test
+ void storesTheKeyForSixtySecondsAndReportsSuccess() {
+ Response response = handler.handle("SendSSHPublicKey", request(INSTANCE, "admin", ED25519), REGION);
+
+ assertEquals(200, response.getStatus());
+ assertEquals(true, ((ObjectNode) response.getEntity()).get("Success").asBoolean());
+ ArgumentCaptor stored = ArgumentCaptor.forClass(InstanceConnectKeys.ActiveKey.class);
+ verify(keys).add(stored.capture());
+ assertEquals("admin", stored.getValue().osUser());
+ assertEquals(NOW.plusSeconds(60), stored.getValue().expiresAt());
+ assertEquals(((ObjectNode) response.getEntity()).get("RequestId").asText(), stored.getValue().requestId());
+ assertEquals("arn:aws:iam::000000000000:root", stored.getValue().caller());
+ }
+
+ @Test
+ void theCallerArnIsInTheDeploymentsPartition() {
+ handlerIn("us-gov-west-1").handle("SendSSHPublicKey", request(INSTANCE, "admin", ED25519), REGION);
+
+ ArgumentCaptor stored = ArgumentCaptor.forClass(InstanceConnectKeys.ActiveKey.class);
+ verify(keys).add(stored.capture());
+ assertEquals("arn:aws-us-gov:iam::000000000000:root", stored.getValue().caller());
+ }
+
+ private InstanceConnectJsonHandler handlerIn(String defaultRegion) {
+ return new InstanceConnectJsonHandler(ec2, keys, new RegionResolver(defaultRegion, "000000000000"), mapper,
+ Clock.fixed(NOW, ZoneOffset.UTC));
+ }
+
+ @Test
+ void rejectsWhatTheServiceModelAndAwsReject() {
+ Map cases = new LinkedHashMap<>();
+ cases.put(request("instance-1", "admin", ED25519), "InvalidArgsException");
+ cases.put(request(INSTANCE, "bad user", ED25519), "InvalidArgsException");
+ cases.put(request(INSTANCE, "admin", "ssh-ed25519 AAAA"), "InvalidArgsException");
+ cases.put(request(INSTANCE, "admin", "ssh-dss " + "A".repeat(100)), "InvalidArgsException");
+ cases.put(request(INSTANCE, "admin", rsaKey(1024)), "InvalidArgsException");
+ // Right type, no key material: SSH could not use these, so they must not report Success.
+ cases.put(request(INSTANCE, "admin", "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5 " + "c".repeat(80)), "InvalidArgsException");
+ cases.put(request(INSTANCE, "admin", sshKey("ssh-ed25519", new byte[31])), "InvalidArgsException");
+ cases.put(request(INSTANCE, "admin", ecdsaKey("nistp256", "nistp384", 65, (byte) 4)), "InvalidArgsException");
+ cases.put(request(INSTANCE, "admin", ecdsaKey("nistp256", "nistp256", 64, (byte) 4)), "InvalidArgsException");
+ cases.put(request(INSTANCE, "admin", ecdsaKey("nistp256", "nistp256", 65, (byte) 2)), "InvalidArgsException");
+ // An ssh-rsa blob with an empty exponent and a zero modulus, and a type label that disagrees with the blob.
+ cases.put(request(INSTANCE, "admin", "ssh-rsa " + blob("ssh-rsa", new byte[0], new byte[256]) + " test"), "InvalidArgsException");
+ cases.put(request(INSTANCE, "admin", "ssh-rsa " + blob("ssh-ed25519", new byte[32]) + " test"), "InvalidArgsException");
+ // RFC 4251 s5: a 2048-bit modulus with its top bit set and no leading 0x00 is a negative mpint.
+ byte[] unsignedModulus = new byte[256];
+ unsignedModulus[0] = (byte) 0x80;
+ cases.put(request(INSTANCE, "admin", "ssh-rsa " + blob("ssh-rsa", new byte[] {1, 0, 1}, unsignedModulus) + " test"), "InvalidArgsException");
+ cases.put(request(INSTANCE, "admin", ED25519 + "\n#Timestamp=9999999999\n" + ED25519), "InvalidArgsException");
+ cases.put(request(INSTANCE, "admin", ED25519.replace("user@host", "us\u0007er@host")), "InvalidArgsException");
+ cases.put(request("i-0000000000000000f", "admin", ED25519), "EC2InstanceNotFoundException");
+ cases.forEach((request, code) -> assertEquals(code, assertThrows(AwsException.class,
+ () -> handler.handle("SendSSHPublicKey", request, REGION)).getErrorCode(), request.toString()));
+
+ instance.setState(InstanceState.stopped());
+ assertEquals("EC2InstanceStateInvalidException", assertThrows(AwsException.class,
+ () -> handler.handle("SendSSHPublicKey", request(INSTANCE, "admin", ED25519), REGION)).getErrorCode());
+ verify(keys, never()).add(any());
+ }
+
+ @Test
+ void serialConsoleIsUnsupportedOnceTheInstanceIsFound() {
+ ObjectNode request = request(INSTANCE, "admin", ED25519);
+ assertEquals("SerialConsoleSessionUnsupportedException", assertThrows(AwsException.class,
+ () -> handler.handle("SendSerialConsoleSSHPublicKey", request, REGION)).getErrorCode());
+ ObjectNode missing = request("i-0000000000000000f", "admin", ED25519);
+ assertEquals("EC2InstanceNotFoundException", assertThrows(AwsException.class,
+ () -> handler.handle("SendSerialConsoleSSHPublicKey", missing, REGION)).getErrorCode());
+ }
+
+ @Test
+ void acceptsAnRsaKeyOf2048Bits() {
+ handler.handle("SendSSHPublicKey", request(INSTANCE, "admin", rsaKey(2048)), REGION);
+ verify(keys).add(any());
+ }
+
+ @Test
+ void acceptsWellFormedEd25519AndEcdsaKeys() {
+ // ECDSA lines are real ssh-keygen -t ecdsa output (throwaway keys, public half only).
+ handler.handle("SendSSHPublicKey", request(INSTANCE, "admin", sshKey("ssh-ed25519", new byte[32])), REGION);
+ handler.handle("SendSSHPublicKey", request(INSTANCE, "admin", "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBKhKXIBq6uSFm4w/wDQuFN9HzZFxgqLbSpaTJB+J6aAHWXBU7rpF1xa7s4dpFzLTSb+xn8JbKWbLozKoeIWV8hw= test"), REGION);
+ handler.handle("SendSSHPublicKey", request(INSTANCE, "admin", "ecdsa-sha2-nistp384 AAAAE2VjZHNhLXNoYTItbmlzdHAzODQAAAAIbmlzdHAzODQAAABhBJFY0hkoTsJID0TIS1BgpJVWTDguQ7sTojV4dfGqMEKjMSAoOnXUdGV1Y+AIhF4rZE9IKsHsjtxg4JYesYz7FR+9CTxHjog7BGzYmVcsVSnRL3t68fT7S3cXhoVkV/3WZA== test"), REGION);
+ handler.handle("SendSSHPublicKey", request(INSTANCE, "admin", "ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBABCp6D79VfVN1Td7nP/lhUWST6qIkN28rgBp1FhyKO2UCTwxObXTOEL7WvfyQ+/J60K21J1ovjtlcC61YhWx0F7eAC/glgVeIBd0leLmmv3YGJkmE7POLgg4nfVXNLJayW3Q8rgyNAROCIC++3Avdn9GZIPrrFnyo1M0aNeW03/dLE2Xg== test"), REGION);
+ verify(keys, times(4)).add(any());
+ }
+
+ /** An ssh-ed25519 line carrying {@code material} as its key. */
+ private static String sshKey(String type, byte[] material) {
+ return type + " " + blob(type, material) + " test";
+ }
+
+ private static String ecdsaKey(String typeCurve, String blobCurve, int pointLength, byte first) {
+ byte[] point = new byte[pointLength];
+ point[0] = first;
+ return "ecdsa-sha2-" + typeCurve + " " + blob("ecdsa-sha2-" + typeCurve, blobCurve.getBytes(StandardCharsets.US_ASCII), point)
+ + " test";
+ }
+
+ private static String blob(String type, byte[]... fields) {
+ byte[] t = type.getBytes(StandardCharsets.US_ASCII);
+ int size = 4 + t.length;
+ for (byte[] f : fields) {
+ size += 4 + f.length;
+ }
+ ByteBuffer b = ByteBuffer.allocate(size).putInt(t.length).put(t);
+ for (byte[] f : fields) {
+ b.putInt(f.length).put(f);
+ }
+ return Base64.getEncoder().encodeToString(b.array());
+ }
+
+ private ObjectNode request(String instanceId, String user, String key) {
+ ObjectNode node = mapper.createObjectNode();
+ node.put("InstanceId", instanceId);
+ node.put("InstanceOSUser", user);
+ node.put("SSHPublicKey", key);
+ return node;
+ }
+
+ /** An ssh-rsa line whose modulus has exactly {@code bits} bits; only its size is ever checked. */
+ private static String rsaKey(int bits) {
+ byte[] type = "ssh-rsa".getBytes(StandardCharsets.US_ASCII);
+ byte[] exponent = BigInteger.valueOf(65537).toByteArray();
+ byte[] modulus = BigInteger.ONE.shiftLeft(bits - 1).toByteArray();
+ ByteBuffer blob = ByteBuffer.allocate(12 + type.length + exponent.length + modulus.length);
+ blob.putInt(type.length).put(type).putInt(exponent.length).put(exponent).putInt(modulus.length).put(modulus);
+ return "ssh-rsa " + Base64.getEncoder().encodeToString(blob.array()) + " test";
+ }
+}
diff --git a/src/test/java/io/floci/aws/services/ec2instanceconnect/InstanceConnectKeysTest.java b/src/test/java/io/floci/aws/services/ec2instanceconnect/InstanceConnectKeysTest.java
new file mode 100644
index 0000000000..a2d97cde01
--- /dev/null
+++ b/src/test/java/io/floci/aws/services/ec2instanceconnect/InstanceConnectKeysTest.java
@@ -0,0 +1,147 @@
+package io.floci.aws.services.ec2instanceconnect;
+
+import io.floci.aws.config.FlociCertificateAuthority;
+import io.floci.aws.services.acm.CertificateGenerator;
+import io.floci.aws.testing.ManualClock;
+import org.bouncycastle.cert.jcajce.JcaX509CertificateHolder;
+import org.bouncycastle.cert.ocsp.BasicOCSPResp;
+import org.bouncycastle.cert.ocsp.CertificateID;
+import org.bouncycastle.cert.ocsp.OCSPResp;
+import org.bouncycastle.cert.ocsp.SingleResp;
+import org.bouncycastle.operator.jcajce.JcaContentVerifierProviderBuilder;
+import org.bouncycastle.operator.jcajce.JcaDigestCalculatorProviderBuilder;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
+
+import java.io.ByteArrayInputStream;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Path;
+import java.security.Signature;
+import java.security.cert.CertificateFactory;
+import java.security.cert.X509Certificate;
+import java.security.spec.MGF1ParameterSpec;
+import java.security.spec.PSSParameterSpec;
+import java.time.Duration;
+import java.time.Instant;
+import java.util.ArrayList;
+import java.util.Base64;
+import java.util.List;
+import java.util.Map;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class InstanceConnectKeysTest {
+
+ private static final String REGION = "us-east-1";
+ private static final Instant NOW = Instant.parse("2026-10-16T12:00:00Z");
+ private static final String KEY = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl test";
+
+ @TempDir
+ Path tlsDir;
+
+ private FlociCertificateAuthority root;
+ private ManualClock clock;
+ private InstanceConnectKeys keys;
+
+ @BeforeEach
+ void setUp() {
+ root = FlociCertificateAuthority.loadOrCreate(tlsDir);
+ clock = new ManualClock(NOW);
+ keys = new InstanceConnectKeys(() -> root, new CertificateGenerator(), clock);
+ }
+
+ @Test
+ void chainIsSignerThenIntermediateThenRootWithTheAgentsExpectedSignerName() throws Exception {
+ List chain = parseChain(keys.signerCertificateChain(REGION));
+
+ assertEquals(3, chain.size());
+ assertEquals("CN=managed-ssh-signer.us-east-1.amazonaws.com", chain.get(0).getSubjectX500Principal().getName());
+ assertEquals("CN=" + InstanceConnectKeys.INTERMEDIATE_CN, chain.get(1).getSubjectX500Principal().getName());
+ assertEquals(root.certificate(), chain.get(2));
+ chain.get(0).verify(chain.get(1).getPublicKey());
+ chain.get(1).verify(root.certificate().getPublicKey());
+ assertTrue(chain.get(1).getBasicConstraints() >= 0, "the intermediate is a CA");
+ assertEquals(-1, chain.get(0).getBasicConstraints(), "the signer is not");
+ assertEquals("Floci_Local_CA", keys.trustAnchorFileStem());
+ }
+
+ @Test
+ void theSignerNameUsesTheRegionsPartitionDomain() throws Exception {
+ assertEquals("CN=managed-ssh-signer.cn-north-1.amazonaws.com.cn",
+ parseChain(keys.signerCertificateChain("cn-north-1")).get(0).getSubjectX500Principal().getName());
+ }
+
+ @Test
+ void eachNonRootCertificateHasAGoodStapleSignedByItsIssuer() throws Exception {
+ List chain = parseChain(keys.signerCertificateChain(REGION));
+ Map staples = keys.ocspStaples(REGION);
+
+ assertEquals(2, staples.size());
+ for (int i = 0; i < 2; i++) {
+ X509Certificate cert = chain.get(i);
+ X509Certificate issuer = chain.get(i + 1);
+ String staple = staples.get(InstanceConnectKeys.sha1Fingerprint(cert));
+ BasicOCSPResp basic = (BasicOCSPResp) new OCSPResp(Base64.getDecoder().decode(staple)).getResponseObject();
+ assertTrue(basic.isSignatureValid(new JcaContentVerifierProviderBuilder().build(issuer.getPublicKey())));
+ SingleResp single = basic.getResponses()[0];
+ assertNull(single.getCertStatus(), "null is OCSP 'good'");
+ CertificateID expected = new CertificateID(new JcaDigestCalculatorProviderBuilder().build()
+ .get(CertificateID.HASH_SHA1), new JcaX509CertificateHolder(issuer), cert.getSerialNumber());
+ assertEquals(expected, single.getCertID());
+ }
+ }
+
+ @Test
+ void activeKeysAreSignedWithRsaPssOverTheHeaderAndKeyLines() throws Exception {
+ keys.add(new InstanceConnectKeys.ActiveKey("i-0123456789abcdef0", "admin", KEY,
+ NOW.plus(InstanceConnectKeys.KEY_LIFETIME), "arn:aws:iam::000000000000:root", "req-1"));
+
+ String document = keys.activeKeysDocument(REGION, "i-0123456789abcdef0", "admin").orElseThrow();
+ String[] lines = document.split("\n", -1);
+ assertEquals("#Timestamp=" + NOW.plusSeconds(60).getEpochSecond(), lines[0]);
+ assertEquals("#Instance=i-0123456789abcdef0", lines[1]);
+ assertEquals(KEY, lines[4]);
+ assertEquals("", lines[6], "a blank line ends each entry");
+
+ String signed = String.join("\n", List.of(lines).subList(0, 5)) + "\n";
+ X509Certificate signer = parseChain(keys.signerCertificateChain(REGION)).getFirst();
+ Signature verifier = Signature.getInstance("RSASSA-PSS");
+ verifier.setParameter(new PSSParameterSpec("SHA-256", "MGF1", MGF1ParameterSpec.SHA256, 32, 1));
+ verifier.initVerify(signer.getPublicKey());
+ verifier.update(signed.getBytes(StandardCharsets.UTF_8));
+ assertTrue(verifier.verify(Base64.getDecoder().decode(lines[5])));
+ }
+
+ @Test
+ void keysAreScopedToTheirUserAndExpireAfterSixtySeconds() {
+ keys.add(new InstanceConnectKeys.ActiveKey("i-0123456789abcdef0", "admin", KEY,
+ NOW.plus(InstanceConnectKeys.KEY_LIFETIME), "caller", "req-1"));
+
+ assertTrue(keys.activeKeysDocument(REGION, "i-0123456789abcdef0", "root").isEmpty());
+ assertTrue(keys.activeKeysDocument(REGION, "i-0000000000000000f", "admin").isEmpty());
+ clock.advance(Duration.ofSeconds(60));
+ assertTrue(keys.activeKeysDocument(REGION, "i-0123456789abcdef0", "admin").isEmpty());
+ }
+
+ @Test
+ void expiredKeysAreDroppedWhenTheNextKeyArrives() {
+ keys.add(new InstanceConnectKeys.ActiveKey("i-0123456789abcdef0", "admin", KEY,
+ NOW.plus(InstanceConnectKeys.KEY_LIFETIME), "caller", "req-1"));
+ clock.advance(Duration.ofSeconds(61));
+ keys.add(new InstanceConnectKeys.ActiveKey("i-0000000000000000f", "admin", KEY,
+ clock.instant().plus(InstanceConnectKeys.KEY_LIFETIME), "caller", "req-2"));
+
+ assertEquals(1, keys.trackedInstanceCount(), "the first instance's expired key is not kept");
+ }
+
+ private static List parseChain(String pem) throws Exception {
+ CertificateFactory factory = CertificateFactory.getInstance("X.509");
+ List chain = new ArrayList<>();
+ factory.generateCertificates(new ByteArrayInputStream(pem.getBytes(StandardCharsets.US_ASCII)))
+ .forEach(cert -> chain.add((X509Certificate) cert));
+ return chain;
+ }
+}
diff --git a/src/test/resources/application.yml b/src/test/resources/application.yml
index a3a6fbd6b7..c2d0d6dae1 100644
--- a/src/test/resources/application.yml
+++ b/src/test/resources/application.yml
@@ -508,6 +508,8 @@ floci:
enabled: true
efs:
enabled: true
+ ec2instanceconnect:
+ enabled: true
organizations:
enabled: true
rum:
diff --git a/tools/aws/regen_iam_request_resources.py b/tools/aws/regen_iam_request_resources.py
index c18dbcac96..df4fd311ec 100644
--- a/tools/aws/regen_iam_request_resources.py
+++ b/tools/aws/regen_iam_request_resources.py
@@ -235,6 +235,7 @@ NOT_COVERED: dict[str, str] = {
"dlm": _REST,
"dms": _LATER,
"ec2": _LATER,
+ "ec2-instance-connect": _LATER,
"ecs": _LATER,
"elasticache": _LATER,
"elasticbeanstalk": "not read yet: an environment's ARN carries its application's name, "
diff --git a/tools/docs/services.yaml b/tools/docs/services.yaml
index 32013a7a75..caccdcd16c 100644
--- a/tools/docs/services.yaml
+++ b/tools/docs/services.yaml
@@ -25,6 +25,10 @@ services:
doc: docs/services/access-analyzer.md
sources:
- { path: services/accessanalyzer/AccessAnalyzerController.java, mode: rest }
+ - service: ec2-instance-connect
+ doc: docs/services/ec2-instance-connect.md
+ sources:
+ - { path: services/ec2instanceconnect/InstanceConnectJsonHandler.java, mode: switch }
- service: acm
doc: docs/services/acm.md
sources: