===== Ubiquiti UniFi CloudKey Backup =====
{{tag>ubiquiti unifi}}
==== QNAP ====
* Enable home folders or make a new share
* Add a new user ''NEWUSER'' and add to the administrators group
* Enable SSH and allow your new user
==== CloudKey ====
* SSH to CloudKey as admin user ''ssh ADMINUSER@IPORNAMEOFCLOUDKEY''
* Generate a new SSH key pair with ''ssh-keygen''
* Copy SSH key to QNAP ''ssh-copy-id NEWUSER@IPORNAMEOFQNAP''
* SSH to QNAP to make sure SSH key authentication works ''ssh NEWUSER@IPORNAMEOFQNAP''
* List home directory (or share destination) ''pwd''
* Exit back to CloudKey ''exit''
* Update apt cache ''apt update''
* Install rsync if needed ''apt -y install rsync''
* Test copy of backup files ''rsync -r --delete /data/autobackup/ NEWUSER@IPORNAMEOFQNAP:/share/homes/NEWUSER/autobackup/''
* Add rsync to crontab ''crontab -e''
SYSTEM$ ssh ADMINUSER@IPORNAMEOFCLOUDKEY
CK# ssh-keygen
CK# ssh-copy-id NEWUSER@IPORNAMEOFQNAP
CK# ssh NEWUSER@IPORNAMEOFQNAP
QNAP$ pwd
QNAP$ exit
CK# apt update
CK# apt -y install rsync
CK# rsync -r --delete /data/autobackup/ NEWUSER@IPORNAMEOFQNAP:/share/homes/NEWUSER/autobackup/
CK# crontab -e
==== AWS S3 / HBS ====
* Add S3 bucket as a storage space
* Create backup job of rsync destination to S3 storage space
* Configure backup job to remote deleted files
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:GetObjectAcl",
"s3:GetObject",
"s3:ListBucket",
"s3:DeleteObject",
"s3:GetBucketAcl",
"s3:GetBucketLocation",
"s3:PutObjectAcl"
],
"Resource": [
"arn:aws:s3:::S3BUCKETNAME",
"arn:aws:s3:::S3BUCKETNAME/*"
]
},
{
"Effect": "Allow",
"Action": "s3:ListAllMyBuckets",
"Resource": "*"
}
]
}