Step 1–Create a simple metric without dimensions 

Using the following code, we will first create a metric without specifying dimensions and then we will post data with dimensions. We can combine both Step 1 and Step 2 for real-world use cases:

aws cloudwatch put-metric-data 
--namespace 'ServerlessProgrammingCookbook'
--metric-name 'FailedLogins'
--value 1
--region us-east-1
--profile admin

We can verify our metric from AWS Management Console as follows:

  1. Log in to Management Console and go to the CloudWatch dashboard.
  2. Click on the Metrics link from the sidebar. We should now see a new custom namespace called ServerlessProgrammingCookbook, along with the AWS namespaces, as shown in the following screenshot:

  1. Click on the custom namespace ServerlessProgrammingCookbook. This will display a link called Metric with no dimensions, as shown in the following screenshot:

This is because we have not defined any dimensions for our metric.

  1. Click on the Metric with no dimensions link. This will show us our new metric. We can now click on the dropdown next to the metric, as shown in the following screenshot, to perform all of the operations that we can perform on an automatically generated metric:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.189.23