Using Amazon CloudWatch Synthetics and Service Lens
Using Amazon CloudWatch Synthetics and Service Lens
Dig deep into the services and applications you run on top of the AWS cloud environment with Amazon CloudWatch Synthetics and Service Lens.
Join the DZone community and get the full member experience.Join For Free
Real-time monitoring is invaluable in today’s market. Everyone is trying to deliver the best user experience, so there is a higher need for capable and reliable cloud services to support the overall performance of your app. Being able to monitor the entire cloud environment in real-time is a huge plus.
As a cloud service provider, Amazon provides its clients with Amazon CloudWatch, an integrated tool for real-time monitoring and metrics tracking. The introduction of CloudWatch Synthetics in November of 2019 brought real-time monitoring to endpoints. Synthetics allow for better monitoring of REST APIs, URLs, and other components.
Another update introduced earlier this year adds an extra layer of real-time monitoring to the equation. Today, you can use ServiceLens—a new tool introduced in the latest update of CloudWatch—to monitor services and applications directly. How do these two features work together in delivering a positive user experience?
Consistency and Security
CloudWatch Synthetics automatically runs tests on your endpoints; the test can be configured to run every minute for maximum consistency, and the testing routine will run continuously 24/7. Since Synthetics specifically monitors endpoints, it is a handy tool to use for monitoring REST APIs, URLs, and the content of your website for changes.
This means you can configure Synthetics to notify you when changes are made to your endpoints. When a malicious script injects spam content or makes unauthorized edits to your frontend, for instance, you know immediately of those changes and can remedy the situation before users are affected by them.
CloudWatch Synthetics also delivers information about the underlying AWS resources of affected endpoints. As a result, you don’t have to manually troubleshoot the issue when it happens. Combined with other monitoring tools, you can also identify security issues based on changes happening at your endpoints.
Even the setup of Synthetics is made easy. You only need to define the URL or API you want to monitor from the Synthetics section of your CloudWatch console to get started. The rest happens automatically in the background and you will start getting reports immediately. For Synthetics, there is no need to set up drivers or dependencies.
Deeper Real-Time Monitoring
CloudWatch ServiceLens, on the other hand, digs deep into the services and applications you run on top of the AWS cloud environment. While most microservices are already designed to be observable and transparent at a certain level, the integration of ServiceLens allows for granular yet continuous monitoring of the entire cluster without adding more stress to the ecosystem.
ServiceLens bridges the gap between CloudWatch and AWS X-Ray. It integrates the two and streams data from X-Ray to your CloudWatch console. At the same time, it performs a degree of data processing to allow for faster analysis and easier monitoring. It is easy to configure ServiceLens for end-to-end monitoring, especially when you compare it to other monitoring tools.
ServiceLens and Service Map
Another huge advantage offered by ServiceLens is its visualization of your application as well as components supporting it. As long as the services are configured to stream monitoring metrics to ServiceLens, you can use the visual Service Map to maintain the entire cloud environment supporting your application.
Integration is the key here. ServiceLens combines metrics and data streams, alerts, logs, and traces in one easy-to-read visual map. The traffic of a service, for example, is represented by the size of that particular service on the Service Map. The bigger the size, the more traffic that service gets.
Other visual cues are just as useful. Faults and errors are represented directly on the map; you can gain additional insights on errors and faults by clicking on a particular service or application on the map and accessing its expanded view. Alarms are displayed too.
You can even identify the type of node you are looking at, with resources and services being displayed as different shapes. The connection between one node and another is represented visually as well, giving you a comprehensive look at the services you have running and the resources you utilize.
Interestingly, ServiceLens supports unknown node types, meaning you can stream metrics from custom services or other components supporting your app, even when it is not natively supported by ServiceLens. As long as you can integrate the X-Ray daemon and CloudWatch agent, you can monitor any node in your cloud environment.
That last part is actually important. Deploying ServiceLens and creating a visual map of your nodes—including how they communicate with each other—is as simple as deploying AWS X-Ray and adding CloudWatch agent and X-Ray daemon. The combination immediately enables service map integration.
Once services are integrated, you can define parameters for alarms. When an alarm is triggered, you can dig deep into the visual map in Request mode or Latency mode. Identifying specific bottlenecks and troubleshooting errors is easy with these tools at your fingertips.
You even have visualization of your service metrics displayed, including latency, requests, faults, and drilldowns such as throttles and invocations. You also have access to traces, which lets you sort requests, check segments timeline, and manually review logs if needed.
CloudWatch ServiceLens is a powerful monitoring tool that you cannot afford to miss. Combined with Synthetics, you can leverage real-time monitoring to maintain user experience at all times.
Published at DZone with permission of Mauricio Ashimine . See the original article here.
Opinions expressed by DZone contributors are their own.