Amazon AWS Certified SysOps Administrator Associate – Monitoring, Auditing and Performance Part 4

  • By
  • June 12, 2023
0 Comment

7. CloudWatch Alarms Hands On

Okay, so we are in Cloudwater alarms, so let’s go and create an alarm. So first of all, I’m going to create an easy to instance very quickly, and we’re going to create an alarm on top of the CPU utilization. So we’ll go ahead and create an easy to instance 32 micro. I will go quickly, type, review and launch, and then say, yes, I have this. So we don’t need to keep it or anything like this. We just want the instance to be launched. And the idea is that we want to create an alarm that will turn terminate the instance if the CPU goes to 100%. So let’s create this alarm. So we need to select a metric. And so for this, we need to choose a metric. So we need to go and find our EC Two instance. So this is our instance ID right here and search for it. And I’m maybe a little bit too quick.

Okay, so let’s wait for the instance to be launched. I will go into EC Two per instance metric, and then I will wait for it to be populating. So it took about five minutes for some metrics to appear in my Cloud Watch dashboard for my instance. So now I can probably refresh this page, and I will get the chance to find the metrics I’m looking for. So let me select the metric and then paste the instance in. Perfect, I have it, and I will go and find the CPU utilization of my instance.

So this is this metric right here. Okay, we’ll select this metric. As you can see, we have it here, and then we can choose a way to compute this metric. So average, sum, maximum, and so on the period we want to evaluate this alarm on. So five minutes is good because this metric gets populated every five minutes if we don’t enable detailed monitoring. Now we get some conditions in terms of the threshold. So is it static or is it anomaly detection? Is it greater than equal to one? And so on.

So I will say, for example, if you are greater than 95% for a long time, so four, and here you can say three out of three. So that means that for 15 minutes you’re stuck at 95%. Then probably something is up with this machine. And so, in that case, I could choose a notification, I could choose an auto scaling action, I could choose an EC two action or in the systems manager action. But I’m going to choose an EC two action and I will say, if you are in alarm, then just terminate this instance. Because maybe I know that my application sometimes has a huge failure and the CPU utilization will be at 95% or 100% for a very long time. And the only way to resolve this is to just terminate the instance.

So I will choose this and then click on Next and say terminate EC Two on high CPU, click on Next to verify everything, and we’re good to go. So now this alarm obviously does have insufficient data, so we need to wait 15 minutes for it to be okay, and it’s not going to be triggered unless we make it. So we could go into the EC Two instance and launch a way to get the CPU very high for 15 minutes, but this would be very long. Or we can use the API call name Set Alarm States to really see what would happen if this alarm went into the breach phase. So let’s have a look.

This is the history of the alarm, okay? And what I’m going to do is that I’m going to set the alarm state type. It is cloud Watch set alarm state. And we’ll look at the API reference. And so we need to do Set Alarm, state the alarm name and the state value and the state reason. So we’ll do in here. So. AWS. Cloud watch set alarm states. And then we need to set multiple parameters. So the alarm name is going to be this one. Then the state value is going to be Alarm, and the state reason is going to be testing. We press Enter and now this alarm, if we refresh this page, is now in the alarm state.

As you can see, it says in alarm. And so the action is when an alarm terminate the instance. And so if you look at the history, it says that the alarm updated from OK to in alarm. And then an action was made and it successfully executed the action to terminate my EC Two instance. So if I go into my E two instances here and I refresh, as you can see, it’s shutting down and it’s being terminated because, well, there was an alarm that was triggered on top of this EC Two instance, and we did set up the alarm to do this specific action. So that’s it. I hope you liked it. I hope this makes sense to you, and I will see you in the next lecture.

8. CloudWatch Events

Now let’s discuss Cloud Watch events. And Cloud Watch Events is now EventBridge as well, but it’s still available within Cloud Watch. So let me show you what it is with Cloud Watch events, you can intercept events happening from within AWS services. So all the sources, for example, you could intercept an easy to instance start a code bit failure, amazon is free Events or Trusted Advisory Events. And you can also intercept any API call with the cloud trail integration.

Okay, you could have it also as well. Instead of intercepting events to be on a schedule or a cron for example, you wanted to just create an event every 4 hours, which is very helpful if you wanted for example, to chain that with a lambda function. So adjacent payload is going to be created for the event and then it’s going to be passed to a target. And you have so many targets in AWS. You have computers such as Lambda Batch, ECS task integrations such as SQS, SNS, Kinesis data streams, connect firehose orchestrations such as Dev functions, code pipeline and code build maintenance such as SSM or EC Two actions.

So CloudWatch Events is a very very powerful service. So let’s go in the hands on to see how it works. So on the left hand side I have my rules and in my rules I can now see that CloudWatch Events is now EventBridge and EventBridge will be in the next lecture has more functionality, maybe this will disappear one day. But right now I just want to show you the Cloud Watch rules from within this interface. So you create a rule and you specify an event pattern and the service name is going to be EC Two. But as you can see, you have a lot of services available in here. Pretty much every service will have CloudWatch Events associated with it. Okay, but what I want is to look at EC Two and the event type is going to be EC Two instance change state, change notification.

So we’re saying okay for this specific state and we can go for example to pending. So anytime an EC Two instance goes into the pending state, meaning that it’s going to be launched, then please create an event. So this is quite handy. And then we can see the event pattern preview. So this is what the rule that we’ve defined here is, but we can also see the simple event that will be created out of this, which is a JSON document, which contains a lot of information around the incident and the state and the resources, the region and so on. Then for targets you can define targets and targets can be many, many different things. As you can see right here, we have a great snapshots API call, we have stop instances, API calls, we have ECS tasks, we have lambda functions and so on. But I just want to send myself an email so I’ll just do SNS topic and then we need to select a topic. So let me just create a topic very quickly. So I will go into the SMS service and I will go to topics and create a topic. And this will be a standard topic called demo topic.

We’ll create this topic and then I will add a subscription. So I want an email subscription. So the protocol is of type email and the endpoint is Stefan@mailingataur. com. We’ll create the description. Now we need to verify the subscription. So for this I will go into the mailing Ataura service and then I will go into a mailbox named Stephan and I will find the subscription confirmation for my SNS subscription. So I’ll click on confirm. So now the subscription is confirmed, so back into SNS. If I refresh this, my status of my subscription is confirmed. So that means that any type of notification sent into here will be sent into my inbox. So if I go back to my inbox and I just delete this email for now, as you can see it’s currently empty. So now what I’m going to do is that I’m going to refresh this page very quickly to make the SNS topic appear. So back into EC Two.

The event is instant state, shared notification and pending, and then the target is going to be an SMS topic and here’s the demo topic. And then for the input we’re going to get the entire matched event. So this entire JSON right here will be sent into my target. So I click on configure details, I’ll call it demo rule, it’s enabled and I will create this role. So this demo rule was created, okay, and now if I go into my EC two console and I’m going to just quickly create an instance, I’ll launch an instance, amazon and X two and I will click on review and launch, launch, and then yes, this instance is now being initiated. And as you can see, the instance state is now pending.

So we expect this clywatch event rule to be triggered and send a notification to my demo topic which will send me an email. So if I go here, as you can see, I just received an email and we can see that from within the email. There’s a full JSON document here that was sent which corresponds to my account ID, the time, the EC to instance that’s concerned, and the state that’s spending. So this Cloud Watch event rule works. And as we’ll see in the next lecture, EventBridge is a way to get CloudWatch events in a separate console, but with more capability.

Okay, and the rules that you create from Cloud Watch events are also going to appear in event bridge. As you can see, my demo rule is right here, but now we have a newer UI and it could be a little bit clearer and has more features as you’ll see in the next lecture. Don’t forget to take your instance and terminate it when you’re done. And that’s it for cloud watch events. I hope you liked it and I will see you in the next lecture.

Comments
* The most recent comment are at the top

Interesting posts

The Growing Demand for IT Certifications in the Fintech Industry

The fintech industry is experiencing an unprecedented boom, driven by the relentless pace of technological innovation and the increasing integration of financial services with digital platforms. As the lines between finance and technology blur, the need for highly skilled professionals who can navigate both worlds is greater than ever. One of the most effective ways… Read More »

CompTIA Security+ vs. CEH: Entry-Level Cybersecurity Certifications Compared

In today’s digital world, cybersecurity is no longer just a technical concern; it’s a critical business priority. With cyber threats evolving rapidly, organizations of all sizes are seeking skilled professionals to protect their digital assets. For those looking to break into the cybersecurity field, earning a certification is a great way to validate your skills… Read More »

The Evolving Role of ITIL: What’s New in ITIL 4 Managing Professional Transition Exam?

If you’ve been in the IT service management (ITSM) world for a while, you’ve probably heard of ITIL – the framework that’s been guiding IT professionals in delivering high-quality services for decades. The Information Technology Infrastructure Library (ITIL) has evolved significantly over the years, and its latest iteration, ITIL 4, marks a substantial shift in… Read More »

SASE and Zero Trust: How New Security Architectures are Shaping Cisco’s CyberOps Certification

As cybersecurity threats become increasingly sophisticated and pervasive, traditional security models are proving inadequate for today’s complex digital environments. To address these challenges, modern security frameworks such as SASE (Secure Access Service Edge) and Zero Trust are revolutionizing how organizations protect their networks and data. Recognizing the shift towards these advanced security architectures, Cisco has… Read More »

CompTIA’s CASP+ (CAS-004) Gets Tougher: What’s New in Advanced Security Practitioner Certification?

The cybersecurity landscape is constantly evolving, and with it, the certifications that validate the expertise of security professionals must adapt to address new challenges and technologies. CompTIA’s CASP+ (CompTIA Advanced Security Practitioner) certification has long been a hallmark of advanced knowledge in cybersecurity, distinguishing those who are capable of designing, implementing, and managing enterprise-level security… Read More »

Azure DevOps Engineer Expert Certification: What’s Changed in the New AZ-400 Exam Blueprint?

The cloud landscape is evolving at a breakneck pace, and with it, the certifications that validate an IT professional’s skills. One such certification is the Microsoft Certified: DevOps Engineer Expert, which is validated through the AZ-400 exam. This exam has undergone significant changes to reflect the latest trends, tools, and methodologies in the DevOps world.… Read More »

img