Last active
January 18, 2024 10:49
-
-
Save danixmarques/65972e76a3a772e1096003ebdf123772 to your computer and use it in GitHub Desktop.
Create lambda resource base policy to allow CloudWatch Alarm invoke a lambda function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create lambda resource base policy to allow CloudWatch Alarm invoke lambda function | |
aws lambda add-permission \ | |
--function-name <your-lambda-function-name> \ | |
--statement-id AlarmAction \ | |
--action lambda:invokefunction \ | |
--principal sns.amazonaws.com \ | |
--source-arn arn:aws:sns:<your-aws-region>:<your-aws-account-id>:<your-sns-topic-name> | |
# Force CloudWatch Alarm become IN ALARM state | |
aws cloudwatch set-alarm-state --alarm-name "<alarm-name>" --state-reason "<some-description>" --state-value ALARM --region <region> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment