Skip to content

Commit

Permalink
Add region to AWS EC2 command to create AMI
Browse files Browse the repository at this point in the history
  • Loading branch information
brwyatt committed Mar 8, 2015
1 parent fa5b5d0 commit 648993d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion scripts/global/createAMI
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ if [[ "x${dateformat}" != "x" ]]; then
fi

instanceid=$(ec2metadata --instance-id)
availabilityzone=$(ec2metadata --availability-zone)
region=${availabilityzone::-1}
timestamp=$(date +"%s")
aminame="${maintainer}_${release}_${timestamp}"
description="Auto-generated at $(date --date="@${timestamp}" +"${dateformat}") from ${maintainer}/${repo}@${release}"

echo -e "\tCreating AMI \"${aminame}\"..."
aws ec2 create-image --instance-id "${instanceid}" --name "${aminame}" --no-reboot &>/dev/null
aws ec2 create-image --region ${region} --instance-id "${instanceid}" --name "${aminame}" --no-reboot &>/dev/null
exval=$?

if [ $exval -eq 0 ]; then
Expand Down

0 comments on commit 648993d

Please sign in to comment.