Understand IMDSv2 Metrics:
IMDSv2 adds a layer of security to EC2 instance metadata by requiring a session token.
TheEC2MetadataNoTokenCloudWatch metric tracks the number of calls to IMDSv1.
Enable the IMDS Metrics:
Ensure that the EC2 instances have theDetailed Monitoringfeature enabled to publish metrics to CloudWatch.
Create a CloudWatch Dashboard:
In the CloudWatch console, create a dashboard that displays theEC2MetadataNoTokenmetric for all instances.
Verify Zero Value:
Monitor theEC2MetadataNoTokenmetric. If the value is zero for all instances, it confirms that IMDSv1 is no longer in use.
Secure Access and Validation:
Regularly monitor the dashboard to ensure no instance reverts to using IMDSv1.
Instance Metadata Service (IMDS) Documentation
CloudWatch Metrics for EC2 Instances
AWS Security Best Practices for Metadata Service