Amazon Cloud Computing, EC2
Contents
Commands
Zu Instanz verbinden
ssh -i certfile root@instancedns.amazon.com
Volume mounten
Das Verzeichnis mnt muss bereits existieren, das Volume muss dem Device /dev/sdf der Instanz über die Amazon Management Console hinzugefügt sein.
mount /dev/sdf /mnt/
AMI Erstellen
Als ersten Schritt muss ein Bucket erstellt werden, in S3 Storage.
Dazu gibt es ein Firefox Plugin: https://addons.mozilla.org/en-US/firefox/addon/3247
Der private key und das Zertifikat lädt man zur Instanz hoch:
scp -i mypem.pem cert-OOOOO.pem root@ec2-174-129-111-208.compute-1.amazonaws.com:/root scp -i mypem.pem pk-OOOOO.pem root@ec2-174-129-111-208.compute-1.amazonaws.com:/root
Dann erstellt man ein Image. Der Befehl wird auf der remote Instanz ausgeführt. Achtung, mit dem -u Parameter gibt man den Username an (Account Number), nicht der Access Key.
ec2-bundle-vol -d /mnt --privatekey ./pk-OOOOO.pem --cert ./cert-OOOOO.pem -u 0888-8888-8888
Dann wird das Image zum S3 Bucket hochgeladen. Dieser Befehl wird auf der remote Instanz ausgeführt.
ec2-upload-bundle -b mybucketname -m image.manifest.xml -a myaccesskeyidentifier -s mysecretkey
Instanz wird registriert. Diesen Befehl wird auf dem lokalen Rechner ausgeführt:
ec2-register mybucketname/image.manifest.xml
ec2-api-tools installieren
So installiert man ec2-api-tools auf Ubuntu:
sudo apt-get install ec2-api-tools sudo apt-get install ec2-ami-tools
Falls diese Fehlermeldung kommt: Package ec2-api-tools is not available, but is referred to by another package. Dann verwendest du eventuell Ubuntu. Das hat bei mir geholfen:
mv /etc/apt/sources.list sources.list.backup
Dann die Datei sources.list mit diesem Inhalt ersetzen (Ubuntu lucid):
#deb cdrom:[Ubuntu 10.04 LTS _Lucid Lynx_ - Release i386 (20100429)]/ lucid main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://ch.archive.ubuntu.com/ubuntu/ lucid main restricted
deb-src http://ch.archive.ubuntu.com/ubuntu/ lucid main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://ch.archive.ubuntu.com/ubuntu/ lucid-updates main restricted
deb-src http://ch.archive.ubuntu.com/ubuntu/ lucid-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://ch.archive.ubuntu.com/ubuntu/ lucid universe
deb-src http://ch.archive.ubuntu.com/ubuntu/ lucid universe
deb http://ch.archive.ubuntu.com/ubuntu/ lucid-updates universe
deb-src http://ch.archive.ubuntu.com/ubuntu/ lucid-updates universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://ch.archive.ubuntu.com/ubuntu/ lucid multiverse
deb-src http://ch.archive.ubuntu.com/ubuntu/ lucid multiverse
deb http://ch.archive.ubuntu.com/ubuntu/ lucid-updates multiverse
deb-src http://ch.archive.ubuntu.com/ubuntu/ lucid-updates multiverse
## Uncomment the following two lines to add software from the 'backports'
## repository.
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
# deb http://ch.archive.ubuntu.com/ubuntu/ lucid-backports main restricted universe multiverse
# deb-src http://ch.archive.ubuntu.com/ubuntu/ lucid-backports main restricted universe multiverse
## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu lucid partner
# deb-src http://archive.canonical.com/ubuntu lucid partner
deb http://security.ubuntu.com/ubuntu lucid-security main restricted
deb-src http://security.ubuntu.com/ubuntu lucid-security main restricted
deb http://security.ubuntu.com/ubuntu lucid-security universe
deb-src http://security.ubuntu.com/ubuntu lucid-security universe
deb http://security.ubuntu.com/ubuntu lucid-security multiverse
deb-src http://security.ubuntu.com/ubuntu lucid-security multiverse