Look up one own's public IP easily

Occasionally, I need to look up my own public IP for various reasons. To do this, I would google “what is my ip”, and got a result on the browser. Recently, I found a way to easily do this using curl command to an easy to remember URL ifconfig.io. Here is an example, of course with the fake IPs as the results: ➜ curl ifconfig.io 2444:3444:20a:5310:d6c9:ffff:fef1:7777 To get the IPv4, we can supply the -4 option to curl command:...

October 28, 2024 · 1 min · 113 words · kenno

How to find instance Id from the instance metadata

For instances which use version 2 of instance metadata, IMDSv2, run the following 2 commands: [ec2-user@ip-172-31-45-35 ~]$ TOKEN=`curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"` [ec2-user@ip-172-31-45-35 ~]$ curl -w "\n" -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/instance-id i-04bd6066612345678 If you use IMDsv1, then there is no need generate the TOKEN value first, just query the instance-id directly: [ec2-user@ip-172-31-45-35 ~]$ curl -w "\n" http://169.254.169.254/latest/meta-data/instance-id In my case, it returned nothing as my EC2 instances uses IMDsV2....

July 7, 2024 · 1 min · 108 words · kenno

FreeBSD git fatal: Unable to find remote helper for 'https'

I just found out that git is not fully functional on my FreeBSD (11) box. It was installed from port (using portmaster git). I can clone a repo using SSH key, but not with HTTPS. I’m not quite sure if it’s always been this way. Here is how to fix it: Reinstall curl # pkg remove curl # portmaster curl Reinstall git # pkg remove git # portmaster git Why did I install git from port?...

July 1, 2016 · 1 min · 94 words · kenno