Answers for "Private DNS EC2 BASH"

0

Private DNS EC2 BASH

export PUBLIC_DNS=`curl http://169.254.169.254/latest/meta-data/public-hostname 2>/dev/null`
export PUBLIC_IP=`curl http://169.254.169.254/latest/meta-data/public-ipv4 2>/dev/null`

function get-pub() {
  if [ $# -ne 1 ]; then
    echo "Invalid number of arguments"
    return 1
  else
    case $1 in
      dns)
        echo $PUBLIC_DNS
        ;;
      ip)
        echo $PUBLIC_IP
        ;;
      *)
        echo $"Usage: get-pub {dns|ip}"
        return 2
    esac;
  fi
  return 0
}
Posted by: Guest on April-08-2020
0

Private DNS EC2 BASH

curl http://169.254.169.254/latest/meta-data/public-hostname
Posted by: Guest on April-08-2020

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language