A guide on how to clone moole into another instance. We take into account that all backups for RDS, EFS and AMI’s for EC2 instances are already set up.
Restore RDS
Navigate into AWS Console.
We either take a new snapshot or we go into already created snapsots and restore the latest.
Steps in order to take a new snapshot.
Navigate into RDS → DB instances.
Select the database we want to take a snapshot from
Actions → Take Snapshot
We give a name of the snapshot and hit create.
Snapshot it will take approximately 15 minutes to finish.
Restore from a snapshot (Manual or Automated).
Navigate into RDS → Snapshots
Select the snapshot we want to restore
Actions → Restore Snapshot
We navigate into a new window where we must select the appropriate Security Groups and availability zones.
Restore DB instance.
Restore EFS
In order to make an EFS backup right away we need to navigate into AWS Backup service.
We select the Create on-demand backup.
Resource type we select EFS
Select the File system ID
Backup window set to “Create backup now“
Transition to cold storage Never
Retention period Always
Backup vault set to Default
IAM role set to Default role
Set tags
Create on-demand backup.
Creating the backup will take approximately ……….. minutes.
In order to restore EFS we need to go into AWS Backup services and then into Backup vaults
Select the EFS we want to restore
Actions → Restore
We can select Full restore if we want the whole EFS or item-level restore if we want a specific directory from the efs.
Restore to a new file system.
Restore role → Default role
Restore backup
This action will take approximately 15 minutes.
Mount EFS into EC2 instance
We assume that our instances already have the nescessary php, apache, packages installed.
In order to mount EFS into ec2 instance we need to make sure that both services exist into the same VPC and availability zone. This action wont work if the above are not correct.
The steps to mount the EFS are:
In EFS dashboard we select the efs that we have restored and we navigate into anoter page
we select Attach we chose the option Mount via DNS
Using the NFS client we select the appropriate command on which we paste into our EC2 console.
example of command
sudo mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport fs-.....:/ efs
After using the command the EFS should be attached into our instance and ready to be used right away.
Some additional commands:
1. Report file system disk usage
df -h
2. persist mount EFS (when restarting server will reattach EFS automatically)
sudo vi /etc/fstab fs-......:/ /efs nfs defaults,_netdev 0 0
3. Check efs mounted successfully
sudo mount -fav