Create getip.sh bash script:
#!/usr/bin/env bash
curl -s https://httpbin.org/ip | grep -oP '(?<="origin": ")[^"]*'
then execute following command
> bash ./getip.sh
OR if you have installed jq library on your instance just run following command:
> curl -s https://httpbin.org/ip | jq '.origin'