Ec2 data using /dev/sdb and sdc?

I am running a neo4j database from an EC2 instance on on AWS. Unfortunately, I recently lost my personal hard drive, and now I can no longer access my PEM (private key) file. That means that I can no longer SSH into the instance. AWS does have a way of changing the key pair for an EC2 instance where the root device is type ebs, but the data in directories /dev/sdb and sdc will be lost.

I have no way of backing up that data, because again I can no longer SSH in. So the question is, if I delete those directories, will I lose any of the data in the database?

depends on where your data directory resides.
The device names don't tell you much if you don't know where they are mounted ...

if the db is still running and you can access it, you could export it e.g. with the apoc.export procedures.

if it's an enterprise instance you might even use the backup tool in the same network

Advanced troubleshooting mode.

  1. Create a new instance on the same region and VPC, with the new key.
  2. Stop the original instance. (Dont terminate it)
  3. On the original instance goto EBS Volume, select the root volume of the lost pem file instance and detach
  4. Once detached, attach it to the new EC2 instance that you created, as a secondary volume.
  5. Login into the new instance with your new key.
  6. Mount the drive, and copy the authorized_keys from the new instance to the attached (original) instance.
  7. After copying detach the secondary volume.
  8. Attach it back to your original instance.
  9. start the original instance.

let me know how it goes.


It is enterprise (neo4j-enterprise-1-3.4.1 2018-06-14T07_13_29Z (ami-2a652655)) and the db is running. But when I tried exporting I got:

Neo.ClientError.Procedure.ProcedureCallFailed: Failed to invoke procedure apoc.export.cypher.all: Caused by: java.lang.RuntimeException: Export to files not enabled, please set apoc.export.file.enabled=true in your neo4j.conf

If I understand, I can't access my neo4j.conf file right now because I can't ssh in anymore. So I don't see how to enable exporting capability.

The AWS support center told me that "whoever created this instance should be aware that the instance store shouldn't be used for persistence data". I'm not clear on how EBS works, but if I used an image from neo4j could I assume that the data is stored in a persistent way?

Thanks, if I do this, when I stop the original instance will data from the database be lost?

Many thanks to @dominicvivek06 (and @michael.hunger) of course.

I just want to update this in case anyone else has the same situation. According to Dominic, the answer (for an Enterprise AMI) is that the data on the database should not be lost by following the process that he gave above, which is essentially the same as

1 Like