Aws metadata curl. PublicIpAddress' --output text 54.

Aws metadata curl. You can store the token and combine the commands.