AWS server migration/scaleup (debian)

I’m using AWS (EC2) for a lot of my work at the moment, I generally run things out of a microinstance, however sometimes I need to scaleup to a larger system to run something computationally intensive. I’m using debian, and this is the script I’m currently using to do this. You’ll need to setup euca-tools, and have .eucarc files for the regions you want to use, but this might help point you in the right direction:

#!/bin/bash

# Region select
REGION=EU
echo $REGION

#for new regions you need to:
#euca-add-keypair keypair_for_regular_debian_machine > keypair_private_$REGION.asc_complete
#chmod 0600 keypair_private_$REGION.asc_complete

cd ~
cp .eucarc_eu .eucarc

# start instance
if [ "$REGION" == "EU" ]
then
  euca-run-instances --instance-type m1.xlarge ami-8992a5fd -k keypair_for_regular_debian_machine
fi

if [ "$REGION" == "JP" ]
then
  echo "JP"
  euca-run-instances --instance-type m1.xlarge ami-22a80223 -k keypair_for_regular_debian_machine
fi

sleep 30

# setup remote system
export NEWSERVER=`euca-describe-instances | tail -n 1 | awk '{print $4}'`
ssh -oStrictHostKeyChecking=no -i keypair_private_$REGION.asc_complete root@$NEWSERVER useradd --shell /bin/bash new
ssh -oStrictHostKeyChecking=no -i keypair_private_$REGION.asc_complete root@$NEWSERVER mkdir  /home/new
ssh -oStrictHostKeyChecking=no -i keypair_private_$REGION.asc_complete root@$NEWSERVER chowan new:users /home/new
ssh -oStrictHostKeyChecking=no -i keypair_private_$REGION.asc_complete root@$NEWSERVER chmod 777 /home/new
ssh -oStrictHostKeyChecking=no -i keypair_private_$REGION.asc_complete root@$NEWSERVER apt-get update
ssh -oStrictHostKeyChecking=no -i keypair_private_$REGION.asc_complete root@$NEWSERVER apt-get -y install make g++ vim gnuplot unison
scp -oStrictHostKeyChecking=no -r -i keypair_private_$REGION.asc_complete /home/new root@$NEWSERVER:/home/new