Skip to content
SudoAll.com

SudoAll.com

Taming Linux

Month: October 2015

Gather metatdata on AWS from within EC2 instance.

Posted on October 12, 2015October 12, 2015 by admin

So I need to get information about a particular set of machines in the cloud (AWS).

EC2_INSTANCE_ID="`wget -q -O - http://instance-data/latest/meta-data/instance-id || die \"wget instance-id has failed: $?\"`"
test -n "$EC2_INSTANCE_ID" || die 'cannot obtain instance-id'
EC2_AVAIL_ZONE="`wget -q -O - http://instance-data/latest/meta-data/placement/availability-zone || die \"wget availability-zone has failed: $?\"`"
test -n "$EC2_AVAIL_ZONE" || die 'cannot obtain availability-zone'
EC2_REGION="`echo \"$EC2_AVAIL_ZONE\" | sed -e 's:\([0-9][0-9]*\)[a-z]*\$:\\1:'`"

 

nJoy 😉

 

 

CategoriesHowtos, Uncategorized

Recent Posts

  • Ichimoku Cloud Trading Strategy – Complete Course
  • Results Analysis and Next Steps
  • Parameter Optimization
  • Building the Strategy Class
  • Python Backtesting Setup

Recent Comments

  • Minxster on How to quit ESXi SSH and leave background tasks running
  • admin on Node.js handling mysql disconnects.
  • admin on How to quit ESXi SSH and leave background tasks running
  • admin on How to quit ESXi SSH and leave background tasks running
  • Thehack904 on How to quit ESXi SSH and leave background tasks running

Archives

Categories

  • AI
  • Amazon Cloud
  • General
  • Hardware
  • Howtos
  • Node Programming
  • Operating System Theory
  • Scripts
  • The Job
  • Troubleshooting
  • Uncategorized

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
Proudly powered by WordPress Arcaia theme by SudoAll