{"record":{"id":"986f328dd629496e","repo":"anomalyco/sst","slug":"no-instance-found-for-cluster-clusterid","errorCode":null,"errorMessage":"No instance found for cluster ${clusterID}","messagePattern":"No instance found for cluster (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/src/components/aws/postgres-v1.ts","lineNumber":523,"sourceCode":"   * Here `app-dev-mydatabase` is the ID of the cluster created in the `dev` stage.\n   * You can find this by outputting the cluster ID in the `dev` stage.\n   *\n   * ```ts title=\"sst.config.ts\"\n   * return {\n   *   cluster: database.clusterID\n   * };\n   * ```\n   */\n  public static get(name: string, clusterID: Input<string>) {\n    const cluster = rds.Cluster.get(`${name}Cluster`, clusterID);\n    const instances = rds.getInstancesOutput({\n      filters: [{ name: \"db-cluster-id\", values: [clusterID] }],\n    });\n    const instance = rds.ClusterInstance.get(\n      `${name}Instance`,\n      instances.apply((instances) => {\n        if (instances.instanceIdentifiers.length === 0)\n          throw new Error(`No instance found for cluster ${clusterID}`);\n        return instances.instanceIdentifiers[0];\n      }),\n    );\n    return new Postgres(name, {\n      ref: true,\n      cluster,\n      instance,\n    } as unknown as PostgresArgs);\n  }\n}\n\nconst __pulumiType = \"sst:aws:Postgres\";\n// @ts-expect-error\nPostgres.__pulumiType = __pulumiType;\n","sourceCodeStart":505,"sourceCodeEnd":538,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/platform/src/components/aws/postgres-v1.ts#L505-L538","documentation":"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.","triggerScenarios":"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.","commonSituations":"Referencing a cluster that was deleted or is in another region; a serverless (Aurora Serverless v1) cluster without provisioned instances; typo'd cluster identifier.","solutions":["Verify the clusterID exists in the target region with `aws rds describe-db-clusters`","Ensure the cluster has at least one running instance (`aws rds describe-db-instances --filters name=db-cluster-id --query ...`)","Use the exact cluster identifier, not the database name or endpoint"],"exampleFix":"// before\nconst db = sst.aws.Postgres.get(\"MyDB\", { cluster: \"wrong-cluster\" });\n// after\nconst db = sst.aws.Postgres.get(\"MyDB\", { cluster: \"my-app-db-cluster\" }); // matches aws rds describe-db-clusters","handlingStrategy":"validation","validationCode":"import { DescribeDBClustersCommand, RDSClient } from \"@aws-sdk/client-rds\";\nconst rds = new RDSClient({ region: \"us-east-1\" });\nconst res = await rds.send(new DescribeDBClustersCommand({ DBClusterIdentifier: clusterID }));\nconst cluster = res.DBClusters?.[0];\nif (!cluster || cluster.DBClusterMembers!.length === 0)\n  throw new Error(`Cluster ${clusterID} not found or has no instances`);","typeGuard":"function hasInstances(c: { DBClusterMembers?: { DBInstanceIdentifier: string }[] } | undefined): c is { DBClusterMembers: { DBInstanceIdentifier: string }[] } {\n  return !!c?.DBClusterMembers && c.DBClusterMembers.length > 0;\n}","tryCatchPattern":"try {\n  const db = sst.aws.Postgres.get(\"MyDB\", { cluster: clusterID });\n} catch (e) {\n  if (String(e).includes(\"No instance found\")) {\n    console.error(`Cluster ${clusterID} missing or empty — verify with aws rds describe-db-clusters`);\n  }\n  throw e;\n}","preventionTips":["Copy the exact DBClusterIdentifier from the AWS console/CLI, not the DB name","Confirm the cluster is in the same region/account as your SST app","Ensure the cluster has at least one running instance before get()"],"tags":["postgres","rds","reference","cluster"],"backgroundTag":"resource-not-found","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}