Docker-machine executor on AWS using IMDSv2

I’m currently using gitlab-runner with docker-machine executor on AWS. In order to reduce security issues, one is supposed to use IMDSv2 which is the AWS metadata service version 2 (enforcing token-based authentication).
I tried the addition from here Add support to AWS EC2 IMDSv2 (#15) · Issues · / CI-CD / docker-machine · GitLab, setting the following docker-machine options with the latest docker-machine version 0.16.2-gitlab.11:

    MachineOptions = [

The bottom two options being the ones of interest.

Upon monitoring the runners being spawned, i noticed that the Cloudwatch metric MetadataNoToken is not zero, therefore metadata request without IMDSv2 being performed. Additionally, the security hub to monitor such instances is complaining.

Anything i’m doing wrong? Or do you have any idea how to enforce the usage of IMDSv2 with docker-machine executor?

Hi @sparrowflo
have you tried to change the last line from
as it was suggested in that GitLab issue?

Thank you @balonik. Yes I did. I just now updated the issue and provided some more information. The behavior is still the same.