aws-samples / amazon-cloudwatch-auto-alarms

Automatically create and configure Amazon CloudWatch alarms for EC2 instances, RDS, and AWS Lambda using tags for standard and custom CloudWatch Metrics.
MIT No Attribution
91 stars 85 forks source link

[ERROR] Adding auto alarm tags to lambda functions #26

Open jbuiles1 opened 1 year ago

jbuiles1 commented 1 year ago

Hello,

When trying to add a tag to a lambda function so that alarms will be created for the lambda function, the alarms are never created. Upon further investigation this error shows up in the cloudwatch logs.

[ERROR] TypeError: create_alarm() takes 9 positional arguments but 10 were given
Traceback (most recent call last):
  File "/var/task/cw_auto_alarms.py", line 155, in lambda_handler
    process_lambda_alarms(function, tags, create_alarm_tag, default_alarms, sns_topic_arn, alarm_separator, alarm_identifier)
  File "/var/task/actions.py", line 112, in process_lambda_alarms
    create_alarm(AlarmName, MetricName, ComparisonOperator, Period, tag['Value'], Statistic, Namespace,

The solution works perfectly fine with EC2 Instances however adding the tag on lambda functions does not seem to work. Is anyone able to use this solution to add alarms to lambda functions as well?

kzuki1337 commented 1 year ago

Hi,

I have not been able to reach that far as of now. I have tagged the lambda with the ALARM_TAG. Then ran the lambda function, but no alarm was created.

Can you please guide me, how to create the alarms for lambda functions and test them without running the actual lamdba functions

Castern commented 1 year ago

I am facing the same issue. After deploying, I tagged one of my lambda functions with the ALARM_TAG however no alarm was generated.

Castern commented 1 year ago

I reached out to @knizami and added the tag with the key Create_Auto_Alarms to the lambda in question. The key does not need any value. This worked for me. I am not sure if that was intended to convey by the README or I was mistaken with the language.