Project

General

Profile

AWS Backup » History » Version 28

Greg Mathis, 05/10/2018 09:56 AM

1 1 Greg Mathis
h1. AWS Backup
2 1 Greg Mathis
3 2 Greg Mathis
We use Perforce and Redmine running on an AWS Server. Our backup strategy is to simply create an Amazon Machine Image (AMI) of the current server state. This AMI can then be used to launch a new server instance which will look just like the original, preserving all Perforce and Redmine data.
4 2 Greg Mathis
5 3 Greg Mathis
h2. Step 1, Create AMI
6 2 Greg Mathis
7 2 Greg Mathis
Log into the AWS console, go to the instances tab, select the server instance to back up, right click, select Image->Create Image.
8 4 Greg Mathis
!picture846-1.png!
9 5 Greg Mathis
10 6 Greg Mathis
Now name the image, check the "No reboot" box, then select "Create Image"
11 5 Greg Mathis
!picture62-1.png!
12 7 Greg Mathis
13 8 Greg Mathis
You should see Create Image request message below.
14 1 Greg Mathis
!picture953-1.png!
15 8 Greg Mathis
16 8 Greg Mathis
h2. Step 2, Prepare AMI
17 8 Greg Mathis
18 8 Greg Mathis
Go to the AMI tab on the AWS console. You should now see the new AMI. (It actually could take a few minutes to appear).
19 8 Greg Mathis
!picture735-1.png!
20 9 Greg Mathis
21 9 Greg Mathis
As part of our backup strategy, we create another server instance of our backup AMI, but we actually run this instance on an entirely different AWS account. The idea here is if the primary AWS account is hacked somehow, and the backup AMI's are deleted, hopefully our "backup" AWS account is not also hacked, and we have a "hot spare" ready to go (Redmine should work right away, but we would need a new Perforce license for the backup server's IP address)
22 10 Greg Mathis
23 15 Greg Mathis
To share this backup AMI with another AWS account, we have to modify the backup AMI's permissions. This step assumes you have already set up a backup AWS account and you have the account id handy. Select the backup AMI, right click, and select "Modify Image Permissions".
24 13 Greg Mathis
!picture968-1.png!
25 14 Greg Mathis
26 15 Greg Mathis
You should then see the following window. Enter in the AWS Account Number of the backup AWS account, select "Add Permission", then check the "create volume" box and then select save.
27 14 Greg Mathis
!picture841-1.png!
28 16 Greg Mathis
29 16 Greg Mathis
At this point this backup AMI is ready to be grabbed by the backup AWS account. So now log in to the backup AWS Console and go to the instances tab. Below is what my backup AWS server currently looks like. For no particular reason, 2 backup servers are running. Only 1 is really necessary.
30 16 Greg Mathis
!picture448-1.png!
31 17 Greg Mathis
32 17 Greg Mathis
Go to the AMIs tab, and change "Owned by me" to "Private Images".
33 17 Greg Mathis
!picture381-1.png!
34 18 Greg Mathis
35 18 Greg Mathis
You should now see the back up AMI we created in the primary account (I misnamed it ... it should say "Back Up 10May2018")
36 18 Greg Mathis
!picture92-1.png!
37 19 Greg Mathis
38 19 Greg Mathis
39 19 Greg Mathis
Now select the AMI, right click and select Launch:
40 19 Greg Mathis
!picture419-1.png!
41 20 Greg Mathis
42 20 Greg Mathis
Choose instance type t2.micro, which it defaults to. Select "Review and Launch".
43 20 Greg Mathis
44 21 Greg Mathis
This will bring up next configuration. Select Edit Security Group and select existing security group and then select "launch wizard-1" ... But the important part are the 6 inbound rules shown below (port 443 is for Redmine, 1666 is for Perforce)
45 21 Greg Mathis
46 21 Greg Mathis
!picture150-1.png!
47 22 Greg Mathis
48 22 Greg Mathis
Then select "Review and Launch" which will bring up the message below:
49 22 Greg Mathis
!picture475-1.png!
50 22 Greg Mathis
51 22 Greg Mathis
Select "Launch", which should bring up a window to select your key pair created when this backup account was created.
52 23 Greg Mathis
!picture298-1.png!
53 24 Greg Mathis
54 24 Greg Mathis
Check the acknowledge box and then select "Launch Instances". Now the new instance should be launching. 
55 24 Greg Mathis
!picture669-1.png!
56 24 Greg Mathis
57 24 Greg Mathis
58 24 Greg Mathis
It may take a few minutes for the new instance to show up in the Instance tab on the AWS Console. Fill in a name.
59 24 Greg Mathis
!picture669-2.png!
60 25 Greg Mathis
61 25 Greg Mathis
Notice the IP address it created for the new backup instance, in this case 18.191.69.218. Point a browser directly to that IP address and you should get the Redmine login page.
62 25 Greg Mathis
!picture482-1.png!
63 26 Greg Mathis
64 27 Greg Mathis
Perforce will not work since the license file is based on the AWS Private IP address, highlighted in the image below.
65 27 Greg Mathis
!picture727-1.png!
66 27 Greg Mathis
Add this point you would have to contact Perforce and get a new license file issued with this new Private IP address.
67 28 Greg Mathis
68 28 Greg Mathis
69 28 Greg Mathis
At this point, you could delete some of the backup instances running on the backup AWS server. You could also delete the backup AMI on the primary server. Otherwise your AWS bill will increase, as you are using more disk space and server running time.
Add picture from clipboard (Maximum size: 97.7 MB)