Skip to content

An AWS Lambda function to expose AWS EC2 scheduled events as a CloudWatch Metric

License

Notifications You must be signed in to change notification settings

markbaird/aws-ec2-events-cloudwatch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Expose AWS EC2 scheduled events as a CloudWatch Metric

An AWS Lambda function to expose AWS EC2 scheduled events as a CloudWatch Metric

Prerequisites:

Setup:

  • Check out this project
  • Modify the role setting in function.json to point to your AWS IAM Lambda execution role with the appropriate settings. The value should be the IAM role's ARN.
  • Deploy the Lambda function to your AWS account using the apex command line tool.
  • In the AWS Lambda console, setup a scheduled event trigger for the deployed function
  • Optional: After running the Lambda function at least once, configure a CloudWatch alert on the new metric

Example IAM Lambda Execution Role:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "logs:CreateLogGroup",
        "logs:CreateLogStream",
        "logs:PutLogEvents"
      ],
      "Resource": "arn:aws:logs:*:*:*"
    },
    {
       "Effect": "Allow",
       "Action": [
         "ec2:DescribeInstanceStatus"
       ],
       "Resource":"*"
     },
     {
       "Sid": "Stmt1463486944000",
       "Effect": "Allow",
       "Action": [
         "cloudwatch:PutMetricData"
       ],
       "Resource": [
         "*"
       ]
     }
  ]
}    

About

An AWS Lambda function to expose AWS EC2 scheduled events as a CloudWatch Metric

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published