Skip to content

Latest commit

 

History

History
51 lines (48 loc) · 1.57 KB

README.md

File metadata and controls

51 lines (48 loc) · 1.57 KB

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