Skip to content

Instantly share code, notes, and snippets.

@kwoods
Last active October 15, 2019 10:49
Show Gist options
  • Select an option

  • Save kwoods/a725c65a1be31ba4403a5bccdcd83627 to your computer and use it in GitHub Desktop.

Select an option

Save kwoods/a725c65a1be31ba4403a5bccdcd83627 to your computer and use it in GitHub Desktop.

Revisions

  1. kwoods revised this gist Jan 30, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion get-stack-name.sh
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    #!/bin/bash
    REGION=$(curl http://169.254.169.254/latest/dynamic/instance-identity/document|grep region|awk -F\" '{print $4}')
    REGION=$(curl -s http://169.254.169.254/latest/dynamic/instance-identity/document|grep region|awk -F\" '{print $4}')
    INSTANCE_ID=$(curl -s http://169.254.169.254/latest/meta-data/instance-id)
    aws ec2 describe-instances \
    --instance-id $INSTANCE_ID \
  2. kwoods created this gist Jan 30, 2017.
    8 changes: 8 additions & 0 deletions get-stack-name.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    #!/bin/bash
    REGION=$(curl http://169.254.169.254/latest/dynamic/instance-identity/document|grep region|awk -F\" '{print $4}')
    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' \
    --region $REGION \
    --output text