You are developing a web application in AWS.
You need to create a CloudWatch custom metric for the application and publish the metric data to AWS via AWS CLI.
You know that for metrics produced by AWS, the metrics data have a one-minute granularity.
However, this standard resolution is not enough for your custom metric as you wish to get more immediate insight into the application's sub-minute activity.
A high resolution with a granularity of one second is required for the metric.
How would you implement this?
Click on the arrows to vote for the correct answer
A. B. C. D.Correct Answer : D.
Option A is incorrect because by default, AWS CLI put-metric-data sets the resolution to 60 seconds and the metric has a one-minute granularity.
Option B is incorrect because you need to modify the AWS CLI put-metric-data for the high resolution.
You cannot set the resolution in the CloudWatch metric graph.
Option C is incorrect because the “--dimensions” argument expands on the identity of a metric using a Name=Value pair, separated by commas.
It does not specify the granularity.
Option D is CORRECT because the StorageResolution option is used to specify the resolution.
When this option is set to 1, CloudWatch stores the metric at 1-second resolution.
Reference:
https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/publishingMetrics.html https://docs.aws.amazon.com/cli/latest/reference/cloudwatch/put-metric-data.htmlThe correct answer for this question is D. When using the AWS CLI put-metric-data to publish the metric data, set the StorageResolution option to 1 second to specify the metric as a high-resolution metric.
Explanation:
CloudWatch is a monitoring service that provides data and actionable insights for applications, infrastructure, and services. It enables users to monitor AWS resources, custom applications, and third-party services. It also provides the ability to create custom metrics to monitor specific events and performance indicators.
AWS CloudWatch offers a standard resolution of one minute for metrics data produced by AWS services. However, some use cases require more immediate insight into application sub-minute activity. For such cases, AWS offers high-resolution metrics with a granularity of one second or less.
To publish a high-resolution custom metric with a granularity of one second, you need to use the AWS CLI put-metric-data command and set the StorageResolution option to 1.
Here is the syntax to publish a high-resolution metric using the AWS CLI put-metric-data command:
scssaws cloudwatch put-metric-data --metric-name MyMetric --namespace MyNamespace --value 1 --timestamp $(date +%s) --storage-resolution 1
In the above command, the --metric-name
and --namespace
options are used to define the metric name and the namespace in which the metric belongs. The --value
option is used to specify the metric value. The --timestamp
option is used to specify the time when the metric was recorded. The --storage-resolution
option is used to set the storage resolution of the metric to 1 second.
Therefore, the correct answer for this question is D. When using the AWS CLI put-metric-data to publish the metric data, set the StorageResolution option to 1 second to specify the metric as a high-resolution metric.