Created
February 1, 2016 04:58
-
-
Save amosshapira/1dd87ff4075d19052d5f to your computer and use it in GitHub Desktop.
Fetch the name of the CloudFormation stack of an EC2 instance
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
| # get instance-id from meta-data, if you like: | |
| INSTANCE_ID=$(curl -s http://169.254.169.254/latest/meta-data/instance-id) | |
| aws ec2 describe-instances \ | |
| --instance-id $INSTANCE_ID \ | |
| --query 'Reservations[*].Instances[*].Tags[?Key==`aws:cloudformation:stack-name`].Value' \ | |
| --output text |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment