Top Level Namespace

Defined Under Namespace

Modules: AMIToolExceptions, AwsRegion, Bundle, Crypto, EC2, EC2Version, FileUtil, Format, Open4, ParameterExceptions, SysChecks, XMLUtil Classes: AMIInvalid, AMITool, BadManifestError, BucketLocationError, BundleDeleter, BundleDownloader, BundleImageParameters, BundleMachineParameters, BundleMigrator, BundleParameters, BundleTool, BundleUploader, BundleVolParameters, DeleteBundleParameters, DeleteFileError, DirectoryError, DownloadBundleParameters, DownloadError, FatalError, FileError, ImageBundler, KernelMappings, Log, LogUtils, ManifestMigrator, ManifestV20070829, ManifestV20071010, ManifestV3, ManifestWrapper, MigrateBundleParameters, MigrateManifestParameters, ParameterError, ParametersBase, S3ToolParameters, ThreadLocalBuffer, UnbundleParameters, Unbundler, UploadBundleParameters, UploadError, VolBundler, XMLBuilder, XMLRPCStruct

Constant Summary collapse

UNBUNDLE_NAME =
'ec2-unbundle'
UNBUNDLE_MANUAL =
<<TEXT
#{UNBUNDLE_NAME} extracts a filesystem image from a bundle AMI.

#{UNBUNDLE_NAME} will:
- read relevant information from the manifest file
- concatenate all the parts
- decrypt and uncompress the image
TEXT
BUNDLE_VOL_NAME =
'ec2-bundle-vol'
BUNDLE_VOL_MANUAL =
<<TEXT
#{BUNDLE_VOL_NAME} is a command line tool that creates an Amazon Machine Image (AMI)
from an existing Fedora Core installation and bundles it. Its output is a
bundled AMI consisting of AMI parts and a manifest. Use the '--help'
option to display help on Bundle Volume parameters.

#{BUNDLE_VOL_NAME} can be run from within an installation, provided there is sufficient space
for the AMI in the destination directory. Note that running Bundle Volume from
within a running installation may be problematic because partially written files
may get copied into the AMI. To minimize this risk it is recommended that the
system is brought down to runlevel 1. Note that this will stop networking, so
only do this if you have access to the console.

If #{BUNDLE_VOL_NAME} is not run from within the installation, the volume belonging to the
installation must be mounted so that it is accessible to #{BUNDLE_VOL_NAME}.

#{BUNDLE_VOL_NAME} will:
- create a sparse filesystem image
- recursively copy the specified volume into the image
- tar -S the image to preserve the sparseness of the image file
- compress the image
- encrypt it
- split it into parts
- generate a manifest file describing the bundled AMI

Recursive Copying

The recursive copying process copies directories from the volume into the image.
The special directories:

- '/dev'
- '/media'
- '/mnt'
- '/proc'
- '/sys'

are always excluded.

Files matching the following regular expressions:

- '*/#*#'
- '*/.#*'
- '*.sw'
- '*.swo'
- '*.swp'
- '*~'
- '*.pem'
- '*.priv'
- '*id_rsa*'
- '*id_dsa*'
- '*.gpg'
- '*.jks'
- '*/.ssh/authorized_keys'
- '*/.bash_history'

are excluded by default on Linux. Individual files that match these patterns may be
included by specifying the '--include' option.

Local directories, which are copied by default, are defined to be those on
filesystems of the following types:

- ext2
- ext3
- xfs
- jfs
- reiserfs

Directories on filesystems that are not of one of the types listed above, such as
remotely mounted NFS filesystems, are excluded by default, but can be copied
by using the '--all' option.

Symbolic links are preserved by the copying process, provided the link target is
copied.

Mounted File Systems

#{BUNDLE_VOL_NAME} will default to bundling the existing /etc/fstab file.

#{BUNDLE_VOL_NAME} will create and bundle AMIs of up to 10GB.

Note:
  Creating the filesystem on the image may fail in the presence of selinux.
  If you are using selinux, you should disable it before using #{BUNDLE_VOL_NAME}.
TEXT
MAX_SIZE_MB =

10 GB in MB

10 * 1024
MAX_SIZE =

10 GB in bytes.

10 * 1024 * 1024 * 1024
BUNDLE_IMAGE_NAME =
'ec2-bundle-image'
BUNDLE_IMAGE_MANUAL =

The manual.

<<TEXT
#{BUNDLE_IMAGE_NAME} is a command line tool that creates a bundled Amazon Machine \
Image (AMI) from a specified loopback filesystem image.

#{BUNDLE_IMAGE_NAME} will:
- tar -S the AMI to preserve sparseness of the image file
- gzip the result
- encrypt it
- split it into parts
- generate a manifest file describing the bundled AMI

#{BUNDLE_IMAGE_NAME} will bundle AMIs of up to 10GB.
TEXT
DELETE_BUNDLE_NAME =
'ec2-delete-bundle'
DELETE_BUNDLE_MANUAL =

——————————————————————————#

<<TEXT
#{DELETE_BUNDLE_NAME} is a command line tool to delete a bundled Amazon Image from S3 storage.
An Amazon Image may be one of the following:
- Amazon Machine Image (AMI)
- Amazon Kernel Image (AKI)
- Amazon Ramdisk Image (ARI)

#{DELETE_BUNDLE_NAME} will delete a bundled AMI specified by either its manifest file or the
prefix of the bundled AMI filenames.

#{DELETE_BUNDLE_NAME} will:
- delete the manifest and parts from the s3 bucket
- remove the bucket if and only if it is empty and you request its deletion
TEXT
RETRY_WAIT_PERIOD =

——————————————————————————#

5
UPLOAD_BUNDLE_NAME =

——————————————————————————#

'ec2-upload-bundle'
UPLOAD_BUNDLE_MANUAL =
<<TEXT
#{UPLOAD_BUNDLE_NAME} is a command line tool to upload a bundled Amazon Image to S3 storage 
for use by EC2. An Amazon Image may be one of the following:
- Amazon Machine Image (AMI)
- Amazon Kernel Image (AKI)
- Amazon Ramdisk Image (ARI)

#{UPLOAD_BUNDLE_NAME} will:
- create an S3 bucket to store the bundled AMI in if it does not already exist
- upload the AMI manifest and parts files to S3, granting specified privileges 
- on them (defaults to EC2 read privileges)

To manually retry an upload that failed, #{UPLOAD_BUNDLE_NAME} can optionally:
- skip uploading the manifest
- only upload bundled AMI parts from a specified part onwards
TEXT
MIGRATE_BUNDLE_NAME =
'ec2-migrate-bundle'
MIGRATE_BUNDLE_MANUAL =

——————————————————————————#

<<TEXT
#{MIGRATE_BUNDLE_NAME} is a command line tool to assist with migrating AMIs to new regions.

*** This tool is deprecated. ***
Please consider using ec2-migrate-image from the EC2 API tools.
You can download the EC2 API tools here:
http://aws.amazon.com/developertools/351

#{MIGRATE_BUNDLE_NAME} will:
- download the manifest of the specified AMI
- attempt to automatically find replacement kernels and ramdisks
- optionally replace kernels and ramdisks with user-specified replacements
- copy AMI into new bucket
- upload new migrated manifest into new bucket

This tool will not register the AMI in the new region.

TEXT
DOWNLOAD_BUNDLE_NAME =

——————————————————————————#

'ec2-download-bundle'
DOWNLOAD_BUNDLE_MANUAL =
<<TEXT
#{DOWNLOAD_BUNDLE_NAME} is a command line tool to download a bundled Amazon Image from
S3 storage. An Amazon Image may be one of the following:
- Amazon Machine Image (AMI)
- Amazon Kernel Image (AKI)
- Amazon Ramdisk Image (ARI)

#{DOWNLOAD_BUNDLE_NAME} downloads and decrypts the manifest, then fetches all
the parts referenced in the manifest.
TEXT
USAGE =
"Usage: decryptmanifest private-key-path"
MIGRATE_MANIFEST_NAME =
"ec2-migrate-manifest"
MIGRATE_MANIFEST_MANUAL =
<<TEXT
#{MIGRATE_MANIFEST_NAME} is a command line tool to assist with migrating AMIs to new regions.

#{MIGRATE_MANIFEST_NAME} will:
- automatically replace kernels and ramdisks with replacements suitable for a
  particular target region
- optionally replace kernels and ramdisks with user-specified replacements

TEXT

Constants included from EC2::Platform::Linux

EC2::Platform::Linux::LOCAL_FS_TYPES

Constants included from EC2::Platform

EC2::Platform::ARCHITECTURES, EC2::Platform::Current, EC2::Platform::IMPLEMENTATIONS, EC2::Platform::PEER

Instance Method Summary collapse

Methods included from EC2::Platform

guess, initialize

Instance Method Details

#assert_true(expr) ⇒ Object



225
226
227
# File 'lib/ec2/amitools/xmlbuilder.rb', line 225

def assert_true(expr)
  raise 'expected true' if !expr
end

#gen_identObject

generate a unique identifier used for filenames



18
19
20
# File 'lib/ec2/amitools/util.rb', line 18

def gen_ident()
  (0..19).inject("") {|ident, n| ident+(?A + Kernel.rand(26)).chr}
end

#open4(*cmd, &b) ⇒ Object



399
# File 'lib/ec2/oem/open4.rb', line 399

def open4(*cmd, &b) cmd.size == 0 ? Open4 : Open4::popen4(*cmd, &b) end