forked from SUSE-Enceladus/ec2imgutils
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathec2uploadimg.1
222 lines (221 loc) · 8.35 KB
/
ec2uploadimg.1
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
.\" Process this file with
.\" groff -man -Tascii ec2uploadimg.1
.\"
.TH ec2uploadimg.1
.SH NAME
ec2uploadimg \- Upload a compressed raw image file to Amazon EC2 and create
a snapshot or an AMI
.SH SYNOPSIS
.B ec2uploadimg [option] PATH_TO_FILE
.SH DESCRIPTION
.B ec2uploadimg
Upload a compressed raw image to Amazon EC2 using an existing EC2 AMI
and create a snapshot or register a new AMI from the image. The apparent
size of the raw image is recommended to be 10 GB or less. It is expected
that the raw image has 1 partition, i.e. the root partition is
.I /dev/sda1.
The process of creating the image is as follows:
- start an instance
- create a storage volume and attach it to the running instance
- create volume that will be the new root and attach it to the running instance
- upload the image
- unpack the image and dump it to the new root volume
- detach the new root volume and create a snapshot
- register a new AMI
- clean up
.SH OPTIONS
.IP "-a --account ACCOUNT_NAME"
Specifies the account to use to connect to EC2. The account is specified
in the config file
.I ~/.ec2utils.conf.
The account is specified as a section with [account-ACCOUNT_NAME] delimiter.
The options of the sections are
.I access_key_id
.I secret_access_key
.I ssh_key_name
.I ssh_private_key
This allows the program to connect to EC2.
If the access_key_id and/or secret_access_key are not found in
.IR ~/.ec2utils.conf,
the search will use the ACCOUNT_NAME to look for a matching section
[profile ACCOUNT_NAME] in
.IR ~/.aws/config
or [ACCOUNT_NAME] in
.IR ~/.aws/credentials.
.IP "--access-id AWS_ACCESS_KEY"
Specifies the AWS access key and overrides the value given for the
.I account
with the
.I access_key_id
in the configuration file.
.IP "-B --backing-store EC2_BACKING_STORE"
Specifies the backing store type for the AMI to be created. The uploaded
image is an EBS (Elastic Block Store) image and my be registered as using
.I SSD
or
.I Magnetic
media as the backing store when being launched. Possible values are
.I ssd,
.I mag,
or
.I ssd,mag.
.IP "--billing-codes BILLING_CODES"
Specifies the billing product codes to apply to the image during
registration. This functionality is restricted to specific accounts
within EC2.
.IP "--boot-kernel AWS_AKI_ID"
Specifies the
.I aki_id
of the boot kernel that should be used when registering a Para-virtual
image. This option overrides the
.I aki_i386,
.I aki_x86_64,
or
.I g2_aki_x86_64
value in the configuration file.
.IP "-d --description IMAGE_DESCRIPTION"
Specifies a description for the image. The description will also be used for
the snapshot.
.IP "-e --ec2-ami AWS_AMI_ID"
Specify the AMI ID of the image to launch that will be used to perform
the upload operation. This value overrides the value given with the
.I ami
option for a given region in the configuration file.
.IP "-f --file CONFIG_FILE"
Specifies the configuration file to use. The default is
.I ~/.ec2utils.conf
.IP "--grub2"
Specifies if the image being uploaded and registered as AMI uses the
.I GRUB2
bootloader. In some cases
.I GRUB2
is referred to as
.I GRUB
and the first incarnation of GRUB is referred to as
.I GRUB-Legacy.
Setting this switch will select the
.I g2_aki_x86_64
value from the configuration file or will use the value given with
.I --boot-kernel
as the aki ID when a para virtual image is being registered.
.IP "-m --machine ARCH"
Specifies the architecture for the VM to be created. Supported values
are
.I arm64
,
.I i386
or
.I x86_64
.IP "-n --name IMAGE_NAME"
Specifies the name of the AMI to be registered.
.IP "-p --private-key-file PRIVATE_KEY"
Specifies the path to the private ssh key file to use to connect with the
instance that is being used to upload the raw image. This option overrides
the value of the
.I ssh_private_key
in the configuration file.
.IP "-r --regions EC2_REGIONS"
A comma separated list of Amazon EC2 regions, or a single region.
.IP "--root-volume-size"
Specify the size in GB of the new root volume for the AMI being created. It
is recommended to keep the root volume size to 10GB or less.
.IP "--ssh-key-pair AWS_KEY_PAIR_NAME"
Specifies the key-pair name to use when launching the instance that is used
to upload the raw image. The specified private key file must correlate
to the key pair name given with this argument. This value overrides the
value given for the
.I account
with the
.I ssh_key_name
in the configuration file.
.IP "-s --secret-key AWS_SECRET_KEY"
Specifies the AWS secret access key and overrides the value given for the
.I account
with the
.I secret_access_key
in the configuration file.
.IP "--security-group-ids AWS_SECURITY_GROUP_IDS"
Specifies a list of security group ids to apply to the helper instance. At
least one of the groups must have port 22 open to support ssh connections.
.IP "--session-token AWS_SESSION_TOKEN"
Specifies the AWS session token. Only necessary when using temporary credentials.
.IP "--snaponly"
When this argument is set only a snapshot of the uploaded image will be
created. The snapshot may then be used in a separate operation to register
an AMI.
.IP "--use-snapshot"
When this argument is set the image will be created from an existing snapshot.
The snapshotID is specified as the source variable.
.IP "--sriov-support"
Enable SRIOV support for HVM images. This implies that the appropriate
driver has to be included in the image.
.IP "--ssh-timeout SSH_TIME_OUT"
Specifies the amount of time to wait in seconds to establish an SSH connection
with the helper instance.
.IP "-t --type AWS_UPLOAD_INST_TYPE"
Specifies the instance type to launch for the instance being used to upload
the image. This value overrides the value given with the
.I instance_type
option for a given region in the configuration file.
.IP "-u --user AWS_INSTANCE_USER"
Specifies the user to use to connect to the instance being used to upload
the image. This value overrides the value given with the
.I user
option for a given region in the configuration file.
.IP "--use-private-ip"
Use the private IP of the helper instance to upload the new image. This is
helpful when an image is to be created and only a private VPC is available.
.IP "--use-root-swap"
Create the new image using the root swap method. The helper instance used
to upload the image will be stopped and the created image volume will be
attached to the helper instance. A new image is registered from the
helper instance. This method of image creation is useful when meta data
associated with the image used to launch the helper instance needs to
be transferred to the new image. The new image creation may time out as
a copy of the complete image disk needs to be made. The code will then skip
the clean up and a storage volume, a target root volume and a stopped
instance will remain in the users account.
.IP "-V --virt-type AWS_VIRT_TYPE"
Specifies the virtualization type to use for the image to be registered.
Possible values are
.I para (default)
or
.I hvm.
.IP "--vpc-subnet-id VPC_SUBNET_ID"
Specify the VPC subnet ID into which the helper instance should be
launched. This option is useful if no default VPC is configured or
it is desired to launch the helper instance into a private subnet of the
VPC. For the use of a private subnet it may also be necessary to use the
.I --use-private-ip
command line option. The ID should start with
.I subnet-.
Instance type and subnets are to a certain degree linked in that it may not
be possible to launch the configured helper instance type outside a VPC
subnet. Therefore, if the
.I --vpc-subnet-id
is not specified on the command line and neither
.I --ec2-ami
or
.I --instance-id
are specified on the command line an attempt will be made to retrieve the
subnet-id from the configuration. The configuration is
.I subnet_id_REGION
where region is one of the known region identifiers such as
.I us-east-1.
The region given with the
.I --regions
command line argument is used. Specifying multiple regions with the
.I --regions
argument and using the
.I --vpc-subnet-id
argument is incompatible. When targeting multiple regions the subnet-id must
be set in the configuration file.
.IP "--wait-count AWS_WAIT_COUNT"
Specifies the number of times to wait for the AWS operation timeout. The
default value is 1 which is equivalent to 600 seconds.
.SH EXAMPLE
ec2uploadimg --account example -d "My first image" -m x86_64 -n my_linux_image -r us-east-1 PATH_TO_COMPRESSED_FILE
Will upload the raw disk image contained in the PATH_TO_COMPRESSED_FILE and
will register a new AMI from the image.
.SH AUTHOR
Robert Schweikert ([email protected])