rasti.hil@hilandco.com +41 79 367-9677

Search This Blog

Update hosts file with LB IP (AWS EC2)

export TS=$(date +%Y%m%d%H%M)
echo $TS
export hosts=/etc/hosts
export hname="soa.hilandco.com soa"
cp $hosts $hosts.$TS
sed /$hname/d $hosts.$TS > $hosts
export dnsalias="`curl http://169.254.169.254/latest/meta-data/local-ipv4` $hname"

echo $dnsalias >> $hosts
cat $hosts