I'm writing an AWS lambda function to take my most recent snapshot of our production database and restore it as a new DB. This worked fine as a RDS instance but we recently switched our main DB to Aurora and its a cluster not an instance.

I looked in the API and was able to repurpose the old logic. I swapped out the word instance for cluster for the most part and it looked to work, it created a new cluster, etc. The new cluster however is showing 0 instances, whereas the DB it originated from shows 1. I think this is preventing me from remote connecting to it like I can the original DB cluster.

I'm still really not sure what a cluster is but do I have to launch an instance separately to enable remote connection?

Here is part of the python script btw -

def byTimestamp(snap):
  if 'SnapshotCreateTime' in snap:
    return datetime.datetime.isoformat(snap['SnapshotCreateTime'])
  else:
    return datetime.datetime.isoformat(datetime.datetime.now())

def restore_db():
    client = boto3.client('rds', region_name=region)
    source_snaps = client.describe_db_cluster_snapshots(DBClusterIdentifier = 'main-production')['DBClusterSnapshots']
    source_snap = sorted(source_snaps, key=byTimestamp, reverse=True)[0]['DBClusterSnapshotIdentifier']

    response = client.restore_db_cluster_from_snapshot(
      DBClusterIdentifier='main-development',
      SnapshotIdentifier=source_snap,
      Port=port,
      Engine='aurora-postgresql')
up vote 3 down vote accepted

Yes, you have to launch an instance in the cluster.

An Aurora cluster has an Aurora Storage Volume with your data, and 0 or more instances that can access it. You can't actually access a cluster's data unless you have at least 1 instance in the cluster.

The reason for this abstraction is that unlike in a conventional database server, where the data is "on the server" and where you have a master server and sometimes one or more replicas, each with a copy of the data, the Aurora master and replicas write to and read from the same storage, and any replica can be promoted to become the master if the master fails.

The console hides some of this from you, if you provision Aurora from there.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.