Created
November 22, 2012 05:12
-
-
Save remino/4129507 to your computer and use it in GitHub Desktop.
EC2 API Tools: Get the ID of an instance from its name
This file contains hidden or 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/bash | |
ec2iid() { | |
ec2-get-instance-id-from-name "$@" | |
} | |
ec2-get-instance-id-from-name() { | |
ec2-describe-instances | grep TAG | grep Name | grep "$@" | \ | |
while read type thing id label value; do | |
[ "$value" == "$@" ] && echo $id && break | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment