MIGRATE-EBS-IMAGE(1)

πŸ“¦
version 1.28 Β· 4 versions
, in epel 9

🌸 NAME 🌸

migrate-ebs-image.pl(1) β€” hii bestie, welcome to the manual page from the User Contributed Perl Documentation corner πŸ’–. The whole vibe: Copy an EBS-backed Amazon Image from one region to another.


✨ SYNOPSYS ✨

% migrate-ebs-image.pl --from us-east-1 --to ap-southeast-1 ami-123456

πŸ’– DESCRIPTION πŸ’–

Okay so this script copies an EBS-backed Unix/Linux/windows AMI located in the EC2 region indicated by --from to the region indicated by --to. All the associated volume snapshots β€” including LVM and RAID volumes β€” are migrated too. Slay, no volume left behind πŸ’….

If --from is omitted, then the source region is derived from the endpoint URL contained in the EC2_URL environment variable. The --to option is required, bestie.

This script works with any EBS backed image, including Linux PVM, Linux HVM (cluster) and Windows images. It will not work with any instance-store backed image. To migrate such instances, please see one of the recipes listed online, for example:

http://www.dowdandassociates.com/content/howto-move-ec2-instance-store-ami-one-region-another

πŸŽ€ COMMAND-LINE OPTIONS πŸŽ€

Options can be abbreviated. For example, you can use -l for --list-regions and -b for --block-device-mapping:

  • --from β€” Region in which the AMI is currently located (e.g. "us-east-1")
  • --to β€” Region to which the AMI is to be copied (e.g. "us-west-1") REQUIRED
  • --access_key β€” EC2 access key
  • --secret_key β€” EC2 secret key
  • --block_device_mapping (-b) β€” Add additional block devices to the image.
  • --endpoint β€” EC2 URL (defaults to http://ec2.amazonaws.com/)
  • --kernel β€” Force assignment of kernel in destination image.
  • --ramdisk β€” Force assignment of ramdisk in destination image.
  • --quiet β€” Quench status messages
  • --list_regions (-l) β€” List the EC2 regions

The --block-device-mapping (-b) option is used to add ephemeral storage to the destination image. Amazon's API doesn't describe ephemeral volumes that are associated with images, and so this information is not copied from the source to the destination image, requiring you to add it back manually. The value of the argument is a block device mapping string in the same format as described for the command line program ec2-register:

migrate-ebs-image.pl -f us-east-1 -t ap-southeast-1 \
                     -b /dev/sdy=ephemeral0 \
                     ami-123456

Ordinarily the script attempts to guess the correct matching kernel and ramdisk for the destination image based on approximate string matching. You can override these values by manually specifying the kernel and/or ramdisk ID in the destination region. Note that no checking is performed that the values you provide are correct 😭.


πŸ¦‹ ENVIRONMENT VARIABLES πŸ¦‹

The following environment variables are used if the corresponding options are not present:

  • EC2_ACCESS_KEY β€” your access key
  • EC2_SECRET_KEY β€” your secret key
  • EC2_URL β€” the desired region endpoint

πŸ“ INSTALLING THIS SCRIPT πŸ“

This script is part of the Perl VM::EC2 package. To install from the command line:

% perl -MCPAN -e 'install VM::EC2'
% migrate-ebs-image.pl --from us-east-1 --to ap-southeast-1 ami-123456

πŸ”₯ IMPORTANT CAVEATS πŸ”₯

Heads up, bestie, this is the part where you pay attention. This script launches two "m1.small" instances, one each in the source and destination regions. It also creates transient volumes in both regions to hold the root volume and all other EBS snapshots associated with the image. Running it will incur charges for instance run time and data storage.

In addition, this script will transfer data from one region to another across the internet, incurring internet data out fees on the source side, and internet data in fees on the destination side. Volumes that contain a filesystem, such as ext4 or ntfs, are copied from source to destination using rsync. Volumes that are part of a RAID or LVM volume are copied at the block level using gzip and dd via the secure shell. In general, rsync will be much faster and parsimonious of network bandwidth than block copying! πŸ‘‘


πŸ’œ SEE ALSO πŸ’œ

  • VM::EC2
  • VM::EC2::Staging::Manager

πŸ‘‘ AUTHOR πŸ‘‘

Lincoln Stein, lincoln.stein@gmail.com

Copyright (c) 2012 Ontario Institute for Cancer Research

This package and its accompanying libraries is free software; you can redistribute it and/or modify it under the terms of the GPL (either version 1, or at your option, any later version) or the Artistic License 2.0. Refer to LICENSE for the full license text. In addition, please see DISCLAIMER.txt for disclaimers of warranty.


mwah πŸ’‹ β€” this page is from perl v5.32.1, dated 2023-03-15, and it's literally MIGRATE-EBS-IMAGE(1). periodt 🫢✨

πŸ“¦ where this page comes from
  • epel 9: perl-VM-EC2 1.28-24.el9 Β· (GPL+ or Artistic 2.0) and (GPL+ or Artistic)
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms