-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathec2_backup_functionality.txt
More file actions
113 lines (84 loc) · 4.04 KB
/
ec2_backup_functionality.txt
File metadata and controls
113 lines (84 loc) · 4.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
EC2-BACKUP(1) BSD General Commands Manual EC2-BACKUP(1)
NAME
ec2-backup -- backup a directory into Elastic Block Storage (EBS)
SYNOPSIS
ec2-backup [-h] [-m method] [-v volume-id] dir
DESCRIPTION
The ec2-backup tool performs a backup of the given directory into Amazon
Elastic Block Storage (EBS). This is achieved by creating a volume of
the appropriate size, attaching it to an EC2 instance and finally copying
the files from the given directory into this volume.
OPTIONS
ec2-backup accepts the following command-line flags:
-h Print a usage statement and exit.
-m method Use the given method to perform the backup. Valid methods
are 'dd' and 'rsync'; default is 'dd'.
-v volume-id Use the given volume instead of creating a new one.
DETAILS
ec2-backup will perform a backup of the given directory to an ESB volume.
The backup is done in one of two ways: via direct write to the volume as
a block device (utilizing tar(1) on the local host and dd(1) on the
remote instance), or via a (possibly incremental) filesystem sync (uti-
lizing rsync(1)).
Unless the -v flag is specified, ec2-backup will create a new volume, the
size of which will be at least two times the size of the directory to be
backed up.
ec2-backup will create an instance suitable to perform the backup, attach
the volume in question and then back up the data from the given directory
using the specified method and then shut down and terminate the instance
it created.
OUTPUT
By default, ec2-backup prints the volume ID of the volume to which it
backed up the data as the only output. If the EC2_BACKUP_VERBOSE envi-
ronment variable is set, it may also print out some useful information
about what steps it is currently performing.
Any errors encountered cause a meaningful error message to be printed to
STDERR.
ENVIRONMENT
ec2-backup assumes that the user has set up their environment for general
use with the EC2 tools. That is, it will not set or modify the variables
AWS_CONFIG_FILE, EC2_CERT, EC2_HOME or EC2_PRIVATE_KEY.
ec2-backup allows the user to add custom flags to the commands related to
starting a new EC2 instance via the EC2_BACKUP_FLAGS_AWS environment
variable.
ec2-backup also assumes that the user has set up their ~/.ssh/config file
to access instances in EC2 via ssh(1) without any additional settings.
It does allow the user to add custom flags to the ssh(1) commands it
invokes via the EC2_BACKUP_FLAGS_SSH environment variable.
As noted above, the EC2_BACKUP_VERBOSE variable may cause ec2-backup to
generate informational output as it runs.
EXIT STATUS
The ec2-backup will exit with a return status of 0 under normal circum-
stances. If an error occurred, ec2-backup will exit with a value >0.
EXAMPLES
The following examples illustrate common usage of this tool.
To back up the entire filesystem using rsync(1):
$ ec2-backup -m rsync /
vol-a1b2c3d4
$ echo $?
0
$
To create a complete backup of the current working directory using
defaults (and thus not requiring a filesystem to exist on the volume) to
the volume with the ID vol-1a2b3c4d:
ec2-backup -v vol-1a2b3c4d .
Suppose a user has their ~/.ssh/config set up to use the private key
~/.ec2/stevens but wishes to use the key ~/.ssh/ec2-key instead:
$ export EC2_BACKUP_FLAGS_SSH="-i ~/.ssh/ec2-key"
$ ec2-backup .
vol-a1b2c3d4
$
To force creation of an instance type of t1.micro instead of whatever
defaults might apply
$ export EC2_BACKUP_FLAGS_AWS="--instance-type t1.micro"
$ ec2-backup .
vol-a1b2c3d4
$
SEE ALSO
aws help, dd(1), tar(1), rsync(1)
HISTORY
ec2-backup was originally assigned by Jan Schaumann
<jschauma@cs.stevens.edu> as a homework assignment for the class "Aspects
of System Administration" at Stevens Institute of Technology in the
Spring of 2011.
BSD March 17, 2014 BSD