gruntwork-io/bash-commons

Make IMDSv2 the default for bash-commons

zackproser opened this issue · 0 comments

With this PR, we implemented support for AWS EC2 Instance Metadata Service version 2.

See the following links for information on the difference between versions 1 and 2 and why version 2 is preferred:

A version switch was implemented here.

It is looking for the env var GRUNTWORK_BASH_COMMONS_IMDS_VERSION, and falling back to the default specified in default_instance_metadata_version. Right now, bash-commons is capable of using either version 1 or version 2 of the IMDS. However, it is currently defaulting to version 1 so as to not break any consumers unexpectedly.

Meanwhile, we are going through our repos and upgrading them to use bash-commons where applicable and to ensure they can use IMDSv2 without issue.

Once we have successfully cut over all our repos to IMDSv2, we should flip bash-commons to use IMDSv2 by default, since it is preferred. We can accomplish this by setting default_instance_metadata_version to 2 right here.