Skip to content

Instantly share code, notes, and snippets.

@Akkiesoft
Created July 29, 2015 07:15
Show Gist options
  • Select an option

  • Save Akkiesoft/05eeea70390129917077 to your computer and use it in GitHub Desktop.

Select an option

Save Akkiesoft/05eeea70390129917077 to your computer and use it in GitHub Desktop.
metadataからホスト名とIPとってくるやつの練習の残骸
#!/bin/bash
hostname_full=`curl -f http://169.254.169.254/latest/meta-data/local-hostname \
--max-time 90 2>/dev/null`
hostname=`echo $hostname_full | cut -d "." -f 1`
local_ip=`curl -f http://169.254.169.254/latest/meta-data/local-ipv4 \
--max-time 90 2>/dev/null`
echo $hostname_full
echo $hostname
echo $local_ip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment