# IMDSv2 Support

**URL:** <https://meta.discourse.org/t/imdsv2-support/272379>\
**Category:** Self-hosting\
**Created:** [July 21, 2023, 9:50am UTC](https://meta.discourse.org/t/imdsv2-support/272379 "2023-07-21T09:50:44Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![chocecil](https://avatars.discourse-cdn.com/v4/letter/c/919ad9/32.png) [@chocecil](https://meta.discourse.org/u/chocecil)\
**Post date:** [July 21, 2023, 9:50am UTC](https://meta.discourse.org/t/imdsv2-support/272379/1 "2023-07-21T09:50:44Z")

</div>

I am writing to inquire about the support of IMDSv2 through instance profiles in Discourse. We are in the process of migrating our service to use IMDSv2, as IMDSv1 is not an secure option.

We would like to understand if Discourse currently supports IMDSv2 through instance profiles and if not, what are the plans to support it in the near future. Additionally, are there any workarounds or patches available that would allow us to use IMDSv2 with Discourse?

It is important for us to ensure that our security requirements are met, and we believe that using temporary credentials through IMDSv2 is a critical aspect of that.

Desired behavior for accessing security credentials provided through the instance profile is

- An application on the instance retrieves the security credentials provided by the role from the instance metadata item `iam/security-credentials/` _role-name_.
- The application is granted the permissions for the actions and resources that we have defined for the role through the security credentials associated with the role. These security credentials are temporary and are rotated automatically. We make new credentials available at least five minutes before the expiration of the old credentials.

We have noted that there are differences between the IMDSv1 and IMDSv2 calls.

IMDSv1 call:

```plaintext
curl http://169.254.169.254/latest/meta-data/iam/security-credentials/s3access

```

While the IMDSv2 call requires the use of a **metadata token** , and can be made using the following commands:

```plaintext
TOKEN=`curl -X PUT "<http://169.254.169.254/latest/api/token>" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"` \\\\\\\\
&& curl -H "X-aws-ec2-metadata-token: $TOKEN" -v <http://169.254.169.254/latest/meta-data/iam/security-credentials/s3access>

```

We would appreciate any information you can provide on how we can use IMDSv2 with Discourse, or if there are any workarounds or patches available.

Reference:

- IMDSv2 Migration : [Transition to using Instance Metadata Service Version 2 - Amazon Elastic Compute Cloud](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-metadata-transition-to-version-2.html)

---

_[View the full topic](https://meta.discourse.org/t/imdsv2-support/272379)._
