title: AWS CloudWatch Agent Monitor Memory With IMDSv2
body: <p>I'm trying to monitor memory on an EC2 Amazon Linux 2 instance. I'm using <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/mon-scripts.html" rel="nofollow noreferrer">these instructions</a> for reference and I'm seeing the error <code>ERROR: Cannot obtain instance id from EC2 meta-data.</code>. I disabled IMDVs1 in my instance which I'm guessing is the way the CloudWatch agent is trying to get my instance id. Does anyone know if there're updated docs on this or a way to fix this? I looked at the AWS script <a href="https://gist.github.com/babo/27bf7398866fb610e7497dffc23b4ae1" rel="nofollow noreferrer">here</a> and I think I could figure out how to have it get this instance ID with IMDSv2 but I'd be surprised if they didn't have a way to do this already. I think I'm missing something though.</p>