anomalyco/sst · error

No instance found for cluster ${clusterID}

Error message

No instance found for cluster ${clusterID}

What it means

When importing an existing RDS cluster by cluster ID, PostgresV1.get() lists the cluster's instances and calls rds.ClusterInstance.get on the first instance identifier. If AWS returns no instance identifiers for the cluster — an empty cluster or a wrong/deleted cluster ID — the plain Error is thrown.

Source

Thrown at platform/src/components/aws/postgres-v1.ts:523

   * Here `app-dev-mydatabase` is the ID of the cluster created in the `dev` stage.
   * You can find this by outputting the cluster ID in the `dev` stage.
   *
   * ```ts title="sst.config.ts"
   * return {
   *   cluster: database.clusterID
   * };
   * ```
   */
  public static get(name: string, clusterID: Input<string>) {
    const cluster = rds.Cluster.get(`${name}Cluster`, clusterID);
    const instances = rds.getInstancesOutput({
      filters: [{ name: "db-cluster-id", values: [clusterID] }],
    });
    const instance = rds.ClusterInstance.get(
      `${name}Instance`,
      instances.apply((instances) => {
        if (instances.instanceIdentifiers.length === 0)
          throw new Error(`No instance found for cluster ${clusterID}`);
        return instances.instanceIdentifiers[0];
      }),
    );
    return new Postgres(name, {
      ref: true,
      cluster,
      instance,
    } as unknown as PostgresArgs);
  }
}

const __pulumiType = "sst:aws:Postgres";
// @ts-expect-error
Postgres.__pulumiType = __pulumiType;

View on GitHub (pinned to a0bd20f762)

Solutions

  1. Verify the clusterID exists in the target region with `aws rds describe-db-clusters`
  2. Ensure the cluster has at least one running instance (`aws rds describe-db-instances --filters name=db-cluster-id --query ...`)
  3. Use the exact cluster identifier, not the database name or endpoint

Example fix

// before
const db = sst.aws.Postgres.get("MyDB", { cluster: "wrong-cluster" });
// after
const db = sst.aws.Postgres.get("MyDB", { cluster: "my-app-db-cluster" }); // matches aws rds describe-db-clusters
Defensive patterns

Strategy: validation

Validate before calling

import { DescribeDBClustersCommand, RDSClient } from "@aws-sdk/client-rds";
const rds = new RDSClient({ region: "us-east-1" });
const res = await rds.send(new DescribeDBClustersCommand({ DBClusterIdentifier: clusterID }));
const cluster = res.DBClusters?.[0];
if (!cluster || cluster.DBClusterMembers!.length === 0)
  throw new Error(`Cluster ${clusterID} not found or has no instances`);

Type guard

function hasInstances(c: { DBClusterMembers?: { DBInstanceIdentifier: string }[] } | undefined): c is { DBClusterMembers: { DBInstanceIdentifier: string }[] } {
  return !!c?.DBClusterMembers && c.DBClusterMembers.length > 0;
}

Try / catch

try {
  const db = sst.aws.Postgres.get("MyDB", { cluster: clusterID });
} catch (e) {
  if (String(e).includes("No instance found")) {
    console.error(`Cluster ${clusterID} missing or empty — verify with aws rds describe-db-clusters`);
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling PostgresV1.get(name, { cluster: "my-cluster-id" }) where the cluster has zero running instances, or the clusterID doesn't match an existing DB cluster in the region/account.

Common situations: Referencing a cluster that was deleted or is in another region; a serverless (Aurora Serverless v1) cluster without provisioned instances; typo'd cluster identifier.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of anomalyco/sst@a0bd20f762 (2026-08-30). Data as JSON: /api/errors/986f328dd629496e. Report an issue: GitHub.