[script][cloud_import] Fix display
This commit is contained in:
parent
60cc24629b
commit
888ee39f77
@ -4,7 +4,7 @@ IFS=$'\n\t'
|
||||
|
||||
ami_import=""
|
||||
s3_import=""
|
||||
today=$(date +%Y-%m-%d.%H:%M:%S)
|
||||
today=$(date +%Y-%m-%d.%HH%Mmin%S)
|
||||
BUCKET=${3:-cloug-vms}
|
||||
IMG_NAME=${1:-current.img}
|
||||
DESC=${2:-"${USER} ${today}"}
|
||||
@ -40,20 +40,22 @@ aws s3 cp ${1:-current.img} s3://$BUCKET
|
||||
|
||||
s3_import=$(mktemp)
|
||||
echo ${S3_IMPORT} > ${s3_import}
|
||||
import_id=$(aws ec2 import-snapshot --description ${DESC} --disk-container file://${s3_import} | grep ImportTaskId | grep ImportTaskId | awk -F: '{print $2}' | sed "s/[ \"]//g")
|
||||
import_id=$(aws ec2 import-snapshot --description ${DESC} --disk-container file://${s3_import} | grep ImportTaskId | grep ImportTaskId | awk -F: '{print $2}' | sed "s/[ \",]//g")
|
||||
|
||||
echo "Wainting for snapshot with import id : $import_id"
|
||||
_SNAP=""
|
||||
while [[ -z ${_SNAP} ]]; do
|
||||
_SNAP=$(aws ec2 describe-import-snapshot-tasks --import-task-ids $import_id | grep "Status" | grep "complete" ) || true
|
||||
echo "."
|
||||
echo -n "."
|
||||
sleep 5
|
||||
done
|
||||
rm $s3_import
|
||||
echo ""
|
||||
|
||||
_SNAP=$(aws ec2 describe-import-snapshot-tasks --import-task-ids $import_id | grep SnapshotId | grep -Eo "snap-[[:alnum:]]*")
|
||||
|
||||
echo "Snaphot Id ${_SNAP}"
|
||||
echo "Import as AMI"
|
||||
|
||||
AMI_IMPORT="
|
||||
[
|
||||
@ -74,3 +76,5 @@ ami=$(aws ec2 register-image --name "$DESC" --architecture x86_64 --virtualizati
|
||||
rm $ami_import
|
||||
echo ${ami}
|
||||
|
||||
echo "Done"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user