IMDSv2 Support

I figured out what was wrong and I just have to blame myself but the issue was quite subtle.
The problem was with “HttpPutResponseHopLimit” set to 1 that did not allowed IMDSv2 to be called from inside the container

Issuing this command I got this answer:

> aws ec2 describe-instances --instance-ids i-00000000000000000 --query “Reservations[0].Instances[0].MetadataOptions”`
{
“State”: “applied”,
“HttpTokens”: “optional”,
“HttpPutResponseHopLimit”: 1,
“HttpEndpoint”: “enabled”,
“HttpProtocolIpv6”: “disabled”,
“InstanceMetadataTags”: “disabled”
}

Adjusting the setting the correct output is

> aws ec2 describe-instances --instance-ids i-00000000000000000 --query “Reservations[0].Instances[0].MetadataOptions”`
{
“State”: “applied”,
“HttpTokens”: “required”,
“HttpPutResponseHopLimit”: 2,
“HttpEndpoint”: “enabled”,
“HttpProtocolIpv6”: “disabled”,
“InstanceMetadataTags”: “disabled”
}

…and finally the mistery is solved :sweat_smile:

Thanks everyone for your help

1 Like