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