こんな感じです。

http://coderepos.org/share/browser/platform/aws/ec2-backup-bundle

#!/bin/bash


# ec2-backup-bundle.sh

#

# This script uses these variables.

#

#    EC2_PRIVATE_KEY

#    EC2_CERT

#    AWS_ACCOUNT_NUMBER

#    AWS_ACCESS_KEY

#    AWS_SECRET_KEY


workdir=/mnt/tmp
bucket=$1

if [ -z "$bucket" ]
then
    echo "Usage: $0 bucket" >&2
    exit 1
fi

if [ ! -d "$workdir" ]
then
    echo "making workdir: $workdir" >&2
    mkdir $workdir
fi

rm -rf $workdir/*

for img in `ec2-describe-images | grep $bucket | awk '{print $2}'`
do
    echo "deregistering existing image..." >&2
    ec2-deregister $img
done

ec2-bundle-vol \

    -k $EC2_PRIVATE_KEY \

    -c $EC2_CERT \

    -u $AWS_ACCOUNT_NUMBER \

    -d $workdir \

    -r `uname -i` \

    -e /var/named/chroot/proc \


ec2-upload-bundle \

    -a $AWS_ACCESS_KEY \

    -s $AWS_SECRET_KEY \

    -b $bucket \

    -m "$workdir/image.manifest.xml" \


ami=`ec2-register "$bucket/image.manifest.xml" | awk '{print $2}'`

ec2-describe-images $ami