Skip to content

How to auto create CloudWatch alarm for memory usage metrics that gets created via CloudWatch agent config file in parameter store?

0

We have a shell script that runs on the first launch of an instance. It has a command that pulls a CloudWatch agent config file from SSM parameter store that collects and sends system/app logs and memory usage to CloudWatch. We need to set a CloudWatch alarm for memory usage each time it gets created. Any ideas on how to do that?

1 Answer
0

Hello.

How about getting events with EventBridge and running Lambda when you start EC2?
Please configure the EventBridge event pattern to catch "runinstances" from CloudTrail.
In Lambda, write code to set up a CloudWatch alarm.

By the way, if you use Systems Manager State Manager to install and configure CloudWatch Agent, there is no need to run a script on EC2.
https://medium.com/@yephonemyatishere/installing-cloudwatch-agent-in-ec2-on-launch-with-state-manager-3504cd486630

EXPERT
answered 2 years ago
EXPERT
reviewed 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Relevant content