Report disk metrics with the user specified device name instead of actual device name (on Nitro systems)
Is your feature request related to a problem? Please describe.
As documented on the NVMe EBS docs page, Nitro based EC2 instances completely ignore the device name requested by the user when creating the instance (e.g. /dev/sda1) and instead attach the device at what is essentially random location (which changes each time you attach/detach the volume e.g. /dev/nvme0n1, /dev/nvme1n1, /dev/nvme2n1, etc).
As a result the disk/IO related metrics reported to Cloudwatch, while technically correct, are essentially not available from an IaC perspective because there is no way to map the volumes you requested to the metrics that are generated.
As a concrete example, assume you create an EC2 instance using the CDK with the following:
declare const vpc: ec2.Vpc;
declare const instanceType: ec2.InstanceType;
declare const machineImage: ec2.IMachineImage;
let instance = new ec2.Instance(this, 'Instance', {
vpc,
instanceType,
machineImage,
// ...
blockDevices: [
{
deviceName: '/dev/sda1',
volume: ec2.BlockDeviceVolume.ebs(50),
},
{
deviceName: '/dev/sdm',
volume: ec2.BlockDeviceVolume.ebs(100),
},
],
});
Now using the instance definition it should be possible to define alarms or create widgets for each of the block devices:
let blockDeviceMappings: BlockDeviceMappingProperty[] = instance.instance.blockDeviceMappings;
blockDeviceMappings.forEach((mapping) => {
// convert '/dev/sda1' to 'sda1'
const metricBasedDeviceName = mapping.deviceName.substring(mapping.deviceName.lastIndexOf('/') + 1);
// define disk based metric alarms for the instance
defineDiskAlarmsForCWAgentMetrics(instance, metricBasedDeviceName);
})
However none of that results in anything useful.
Describe the solution you'd like Report metrics with the requested device name instead of the actual device name (on Nitro based instances), at least as option we can turn on....
Describe alternatives you've considered There are no alternative we can find, basically there is no way to declaratively use the disk metrics reported by the cloudwatch agent (except with a lot of manual stuffing around).
Additional context Add any other context or screenshots about the feature request here.