An AWS Lambda function to expose AWS EC2 scheduled events as a CloudWatch Metric
Switch branches/tags
Nothing to show
Clone or download
Latest commit 7d58539 Feb 24, 2017
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
functions/instance-status Initial commit Feb 23, 2017
.gitignore Initial commit Feb 23, 2017
LICENSE Initial commit Feb 23, 2017
README.md Initial commit Feb 23, 2017
project.json Initial commit Feb 23, 2017

README.md

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": [
         "*"
       ]
     }
  ]
}