AWS SDK is unable to instantiate a new EC2 instance when Jenkins server runs on a AWS EC2 with IMDSv2 set as required

XMLWordPrintable

      I have a Jenkins server running from the jenkins:latest docker image publicly available. Currently sitting at 2.551. It runs within a hardened Ubuntu 22.04, on an EC2 instance.

      We have configured a Cloud within Jenkins to create worker nodes on demand from an AMI (see attached images) with particular labels. These cloud settings already use the `Instance Metadata Supported` checkbox and its children, `Enable Metadata HTTP Endpoint` and `Metadata Require HTTP Tokens`

      This setup has worked as expected for years, until we were forced to set the server's IMDSv2 setting to required (equivalent to `aws ec2 modify-instance-metadata-options --http-tokens=required`).
      This single change causes an issue when the AWS SDK plugin attempts to instantiate new EC2 nodes, (see the attached log).

      Changing this setting to `aws ec2 modify-instance-metadata-options --http-tokens=optional` for the server EC2 restores the expected behavior.

      The organization is enforcing a mandatory use of IMDSv2, so this really blocks our CI/CD pipelines. Also attaching the list of installedPlugins, in case the version is needed.

        1. Screenshot_20260312_123040.png
          21 kB
          Andres Salcedo
        2. Screenshot_20260312_123224.png
          79 kB
          Andres Salcedo
        3. 20260312.Jenkins_vs_IMDSv2.log
          181 kB
          Andres Salcedo
        4. Jenkins.installedPlugins.txt
          9 kB
          Andres Salcedo

            Assignee:
            Basil Crow
            Reporter:
            Andres Salcedo
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: