2008年10月06日

Amazon EC2をS3へフルバックアップ

livedoorClipに登録 | このエントリーをはてなブックマークに追加 | del.icio.usに登録 | MM/Memoに登録

概要

  • EC2をA3へバックアップする手順をまとめた文書

補足

  • EC2はインスタンスを停止させるとデータがクリアされてしまうのでデータのバックアップが必要
  • そこでEC2用ストレージであるS3へバックアップを行う
  • 今回はAMIまるごとバックアップ

作業内容

EC2のイメージのバックアップファイル作成
$ ec2-bundle-vol -d /mnt -k /mnt/pk-*****.pem -c /mnt/cert-*****.pem -u 2337-8359-0872
Please specify a value for arch [i386]: <--- エンター
Copying / into the image file /mnt/image...
Excluding:
         /sys
         /proc
         /proc/sys/fs/binfmt_misc
         /dev
         /media
         /mnt
         /proc
         /sys
         /mnt/image
         /mnt/img-mnt
1+0 records in
1+0 records out
1048576 bytes (1.0 MB) copied, 0.002869 seconds, 365 MB/s
mke2fs 1.39 (29-May-2006)
/etc/fstab:
         # Legacy /etc/fstab
         # Supplied by: ec2-ami-tools-1.3-20041
         /dev/sda1 /     ext3    defaults 1 1
         /dev/sda2 /mnt  ext3    defaults 0 0
         /dev/sda3 swap  swap    defaults 0 0
         none      /proc proc    defaults 0 0
         none      /sys  sysfs   defaults 0 0
Bundling image file...

.....

Creating bundle manifest...
ec2-bundle-vol complete.

ファイルが作成されている事を確認

  • image.manifest.xml
  • image.part.*
S3へアップロード

先の手順で生成されたimage.manifest.xmlが必要

  • -b でバケット名を指定可能
  • -aでアクセスキーを指定
  • -sで秘密アクセスキー指定
# ec2-upload-bundle -b centos5.0-2008081101 -m /mnt/image.manifest.xml -a アクセスキー -s 秘密アクセスキー
Uploading bundled image parts to https://s3.amazonaws.com:443/centos5.0-2008081101 ...
Uploading manifest ...
Uploaded manifest to https://s3.amazonaws.com:443/centos5.0-2008081101/image.manifest.xml.
Bundle upload completed.
AMIへ登録

FirefoxのアドオンElasticfoxを利用

  1. タブから「AMIs and Instances」を選択
  2. 「Machine Images (AMIs)」から「+」をクリック
  3. 「AIM Manifest Path:」に 「centos5.0-2008081101/image.manifest.xml」を指定して「OK」
  4. 「Machine Images (AMIs)」に「centos5.0-2008081101/image.manifest.xml」がある事を確認


半袖 at 14:30│Comments(2)TrackBack(0)サーバ管理 

トラックバックURL

この記事へのコメント

1. Posted by zaki   2009年04月01日 22:01
全部AIMって書いてあるけどAMIなのでは
2. Posted by 半袖   2009年04月02日 10:47
失礼しました。
ご指摘ありがとうございます!

この記事にコメントする

名前:
URL:
  情報を記憶: 評価: 顔