Last active
December 20, 2015 11:48
-
-
Save nagataka/6125786 to your computer and use it in GitHub Desktop.
create EC2 instance with adding arbitrary number of tags to attached EBS volume.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ "$1" = "" ] | |
then | |
echo usage $0 key=value [[key=value] ... ] | |
exit 0 | |
else | |
instance=`ec2-run-instances ami-39b23d38 | awk '{print $2}' | grep i-` | |
sleep 3 | |
volume=`ec2-describe-volumes | grep $instance | awk '{print $2}'` | |
for vol in ${volume[@]}; do | |
while [ "$1" != "" ]; do | |
ec2-create-tags "$vol" --tag "$1" | |
shift | |
done | |
done | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment