Curl-url-http-3a-2f-2f169.254.169.254-2flatest-2fapi-2ftoken

: Sets the time-to-live (TTL) for the token in seconds. Here, it is valid for 6 hours (21600 seconds). 2. Use the Token to Request Metadata

The raw command curl http://169.254.169.254/latest/api/token (without -X PUT ) will return an error like: curl-url-http-3A-2F-2F169.254.169.254-2Flatest-2Fapi-2Ftoken

TOKEN=$(curl -s http://169.254.169.254/latest/api/token -H "X-aws-ec2-metadata-token-ttl-seconds: 21600") : Sets the time-to-live (TTL) for the token in seconds