-
Notifications
You must be signed in to change notification settings - Fork 0
Backup Lite
Scott Madara edited this page Nov 2, 2018
·
28 revisions
Backing up your Solodev CMS Lite involves creating an S3 bucket to store all necessary backup files, creating an IAM user for credentialed access, logging in via SSH to the EC2 server, modifying the backup scripts to use your unique credentials, and finally running the backup script itself. Before beginning this process, please take note of these prerequisites:
- IAM User
- IAM User ARN
- IAM User Access Key
- IAM User Secret Key
- S3 Bucket
- S3 Bucket Name
- EC2 Key Pair
- In order to SSH into the server
- This should be the same Key Pair selected when originally installing the software
- Within your AWS account, navigate to the "Identity and Access Management (IAM)" dashboard
- Click on "Users"
- Click on "Add user"
- On the "Add user - 1" screen:
- Give your user a unique name
- Select "Programmatic access" under Access Type
- Click on the "Next: Permissions" button to continue
- On the "Add user - 2" screen:
- Leave all options set to their defaults under "Set permissions"
- Leave all options set to their defaults under "Set permissions boundary"
- Click on the "Next: Review" button to continue
- On the "Add user - 3" screen:
- Click on the "Create user" button to continue
- On the "Add user - 4" screen:
- Copy/save the "Access key ID" (This will be needed later)
- Copy/save the "Secret access key" (This will be needed later)
- Click "Close" to return the the Users screen
- Click on the user account you just created
- Copy/save the "User ARN" (This will be needed later)
- Within your AWS account, navigate to the "Amazon S3" dashboard
- Click on the "+ Create bucket" button
- Give your button a DNS-compliant name (all lower case, dashes instead of spaces, etc.)
- Select the region of your bucket
- Click the "Next" button to continue
- On the "Configure options" screen:
- Configure advanced options (although defaults are recommended)
- Click "Next" to continue
- On the "Set permissions" screen:
- Configure advanced options (although defaults are recommended)
- Click "Next" to continue
- Review your options and click on the "Create bucket" button to continue
- You will return tot he "Amazon S3" dashboard; click on the bucket you just created
- Under the "Permissions" tab, click on the "Bucket Policy" button
- Copy and paste the following code into the Bucket policy editor (the following code can also be found the EC2 server for the CMS at "/root/s3-backup-bucket.policy")
- Replace all instances of "IAM-USER-ARN" with the User ARN collected in Step 1 - Create a New IAM User
- Replace all instances of "BUCKET-NAME" with the bucket name you created in Step 2 - Create a New S3 Bucket
- Once changed, your bucket policy code should look like:
- Click "Save" to set the new bucket policy
- If you encounter an error saving, double check that your values have the correct spelling and attributes
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Backup Permssions",
"Effect": "Allow",
"Principal": {
"AWS": [
"IAM-USER-ARN"
]
},
"Action": [
"s3:PutObject",
"s3:GetObject"
],
"Resource": "arn:aws:s3:::BUCKET-NAME/*"
},
{
"Sid": "Backup Permssions 2",
"Effect": "Allow",
"Principal": {
"AWS": [
"IAM-USER-ARN"
]
},
"Action": "s3:ListBucket",
"Resource": "arn:aws:s3:::BUCKET-NAME"
}
]
}
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Backup Permssions",
"Effect": "Allow",
"Principal": {
"AWS": [
"arn:aws:iam::893612263489:user/solodev-cms-lite-user"
]
},
"Action": [
"s3:PutObject",
"s3:GetObject"
],
"Resource": "arn:aws:s3:::solodev-cms-lite-bucket/*"
},
{
"Sid": "Backup Permssions 2",
"Effect": "Allow",
"Principal": {
"AWS": [
"arn:aws:iam::893612263489:user/solodev-cms-lite-user"
]
},
"Action": "s3:ListBucket",
"Resource": "arn:aws:s3:::solodev-cms-lite-bucket"
}
]
}
- Refer to the "SSH Into an EC2 Server" on the Common Tasks & Commands page for instructions on connecting to the server through an SSH client
- Once connected, assume admin rights by running "sudo bash"
- Edit the primary backup script located at "/etc/duply/backup/conf" (refer to the "Editing Files on the Server with Vi" on the Common Tasks & Commands page for instructions on how to edit with a SSH client)
- The lines that need to be updated are located at the bottom of the file:
- Change these values to include the bucket name, IAM Access Key, and IAM Secret key created in Step 1 - Create a New IAM User and Step 2 - Create a New S3 Bucket.
- Once you've made your changes, exit insert mode and save your changes
TARGET='s3+http://BACKUP-BUCKET/backups' export AWS_ACCESS_KEY_ID=IAM_ACCESS_KEY export AWS_SECRET_ACCESS_KEY=IAM_SECRET_KEY
- Refer to the "SSH Into an EC2 Server" on the Common Tasks & Commands page for instructions on connecting to the server through an SSH client
- Once connected, assume admin rights by running "sudo bash"
- Run the backup command by typing the following:
- You will then see confirmation that a backup has occurred
- You can double check that a backup has occurred by checking the S3 bucket you created in Step 2 - Create a New S3 Bucket
/root/backup.sh
© 2019 Solodev. All rights reserved worldwide. And off planet. Visit solodev.com to learn more.