Skip to content

Instantly share code, notes, and snippets.

@danixmarques
Last active January 18, 2024 10:49
Show Gist options
  • Save danixmarques/65972e76a3a772e1096003ebdf123772 to your computer and use it in GitHub Desktop.
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
# 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