This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* author Huber Flores | |
*/ | |
# Upload your keys to your instance (*.pem files) | |
$ scp -i your_PrivateKeyFile.pem -r /PrivateKeysPath/huberfloresPrivateCertKeys.zip ubuntu@ec2-x-x-x-x.compute-1.amazonaws.com:/home/ubuntu/ | |
# Connect to your instance (local keys) | |
$ ssh -i your_PrivateKeyFile.pem ubuntu@ec2-x-x-x-x.compute-1.amazonaws.com | |
$ sudo su | |
$ mkdir /mnt/img-mnt | |
# put cert.pem and *.pem in /mnt/img-mnt or another folder depending on the AMI | |
$ chmod 777 /mnt/img-mnt/ | |
$ cd img-mnt/ | |
# Bundle the image | |
$ ec2-bundle-vol -r i386 -d /mnt/ -p "myami" -u 111222333 -k /mnt/img-mnt/your_PrivateKeyFile.pem -c /mnt/img-mnt/your_PrivateKeyFile_cert.pem | |
# AmazonID is a long number. For example 111-222-333, you have to remove the hyphens 111222333 | |
# issues that can emerged | |
# if fails due to limited space, then delete smt from disk | |
# also, this process will create an image in ./tmp/image, you have to delete it | |
# Notice that "-d /mnt" specifies the bundling point, thus this can solve the problem if /tmp has small space | |
Copying / into the image file /mnt/myami... | |
Excluding: | |
/sys/kernel/debug | |
/sys/kernel/security | |
/sys | |
/proc | |
/dev/pts | |
/dev | |
/dev | |
/media | |
/mnt | |
/proc | |
/sys | |
/etc/udev/rules.d/70-persistent-net.rules | |
/etc/udev/rules.d/z25_persistent-net.rules | |
/mnt/myami | |
/mnt/img-mnt | |
1+0 records in | |
1+0 records out | |
1048576 bytes (1.0 MB) copied, 0.0098151 s, 107 MB/s | |
mke2fs 1.41.11 (14-Mar-2010) | |
warning: Unable to get device geometry for /mnt/myami | |
Bundling image file... | |
Splitting /mnt/myami.tar.gz.enc... | |
Created myami.part.00 | |
Created myami.part.01 | |
Created myami.part.02 | |
Created myami.part.03 | |
. | |
. | |
. | |
Creating bundle manifest... | |
ec2-bundle-vol complete. | |
# Upload to S3 (use the keys not the files) | |
$ ec2-upload-bundle -b MyInstanceBucket -m /mnt/myami.manifest.xml -a AccessKey -s SecretKey | |
The specified bucket is not S3 v2 safe (see S3 documentation for details): | |
MyInstanceBucket | |
Are you sure you want to continue? [y/N]y | |
Uploading bundled image parts to the S3 bucket TNodeBucket ... | |
Uploaded myami.part.00 | |
Uploaded myami.part.01 | |
. | |
. | |
. | |
Uploaded myami.part.90 | |
Uploaded myami.part.91 | |
Uploading manifest ... | |
Uploaded manifest. | |
Bundle upload completed. | |
# Register image | |
$ ec2-register MyInstanceBucket/myami.manifest.xml -n myinstance -K your_PrivateKeyFile.pem -C your_PrivateKeyFile_cert.pem | |
IMAGE ami-cxxxxxab |
No hay comentarios:
Publicar un comentario