Fix metadata service not reachable from instance

The warning message like below
    checking http://169.254.169.254/2009-04-04/instance-id
    failed 1/20: up 7.41. request failed
    failed 2/20: up 9.95. request failed
    failed 3/20: up 12.33. request failed
    failed 4/20: up 14.73. request failed
    failed 5/20: up 17.15. request failed

Please help me to review the code.