Monitor the solution - Instance Scheduler on AWS

Monitor the solution

Logging and notifications

Instance Scheduler on AWS leverages Amazon CloudWatch Logs for logging. This solution logs processing information for each tagged instance, the results of the period evaluation for the instance, the desired state of the instance during that period, the applied action, and debugging messages. For more information, refer to Solution resources.

Warning and error messages are also published to a solution-created Amazon SNS topic, which sends messages to a subscribed email address. For details, refer to What is Amazon SNS? in the Amazon SNS Developer Guide. You can find the name of the Amazon SNS topic in the Outputs tab of the solution stack.

Log files

The Instance Scheduler on AWS creates a log group that contains the default AWS Lambda log files and a log group that contains the following log files:

  • InstanceScheduler-yyyymmdd: Logs general scheduler messages

  • SchedulingOrchestratorHandler-yyyymmdd: Logs general orchestration information for when scheduling executions are started

  • SchedulerSetupHandler-yyyymmdd: Logs the output of configuration actions

  • Scheduler-<service>-<account>-<region>-yyyymmdd: Logs scheduling activity in each service, account, and region

  • CliHandler-yyyymmdd: Logs requests from the admin CLI

  • Eventbus_request_handler-yyyymmdd: Logs the calls to the EventBus resources, if the solution is deployed to AWS organizations.

  • CollectConfigurationDescription-yyyymmdd : Logs configuration description metric data that is sent periodically

Operational insights dashboard

Instance Scheduler on AWS comes with an Operational Insights dashboard that allows you to monitor the operation of the solution and get insight into the running hours that have been saved by using this solution.

To use this dashboard, ensure that Operational Monitoring is set to "enabled" in the solution's hub stack parameters in AWS CloudFormation. Then go to AWS CloudWatch and select "Dashboards" from the navigation menu. The dashboards name will be {stack-name}-Operational-Insights-Dashboard

The dashboard will display various operational metrics about the operations of your solution including counts of how many instances are currently being managed by the solution, information on when and how many instances are running throughout the day, and an estimation of how many running hours have been saved by shutting instances down. Sample data below:

Instance Scheduler AWS stack in CloudWatch

Controlled EC2 instances by Schedule

Note

The information in these graphs is dependent upon the scheduling interval configured on the solution hub stack. When updating the solution's scheduling interval, the dashboard will only display scheduling metrics from after the most recent update to the scheduling interval.

The dashboard also provides insight into the health of Lambda functions that are critical to the operation of the solution. If the average Lambda duration for any of the depicted Lambda functions begins to approach the yellow zone, it may be time to increase the Lambda size property on the solution hub stack.

Lambda duration

Depicted: AsgHandler is raising consistent errors over multiple days. This indicates a potential problem with ASG scheduling and should prompt further investigation into the logs for that Lambda

Additional costs associated with this feature

This operational dashboard is powered by custom CloudWatch metrics collected by the solution that will incur additional cost. This feature can be turned off by disabling "Operational Monitoring" on the solution hub stack. This feature costs an additional $3.00/month plus additional scaling costs based on the size of your deployment. The costs are as follows:

Custom CloudWatch Dashboard $3
Per-schedule metrics $0.60 per schedule*
Per-instance-type metrics $0.90 per instance type*
API usage ~$0.10 per account/region

* These costs are tracked per service category (EC2/RDS) and only for schedules/instance types actually used for scheduling. For example, if you have 15 schedules configured, with three for RDS and five for EC2, the total cost will be 8*$0.60 or $4.80/month. Inactive schedules will not be billed.

Monitor the solution with Service Catalog AppRegistry

The solution includes a Service Catalog AppRegistry resource to register the CloudFormation template and underlying resources as an application in both Service Catalog AppRegistry and AWS Systems Manager Application Manager.

AWS Systems Manager Application Manager gives you an application-level view into this solution and its resources so that you can:

  • Monitor its resources, costs for the deployed resources across stacks and AWS accounts, and logs associated with this solution from a central location.

  • View operations data for the resources of this solution in the context of an application, such as deployment status, CloudWatch alarms, resource configurations, and operational issues.

    The following figure depicts an example of the application view for Instance Scheduler on AWS stack in Application Manager.

Instance Scheduler on AWS in Application Manager

Solution stack in Application Manager

Note: You must activate CloudWatch Application Insights, AWS Cost Explorer, and cost allocation tags associated with this solution. They are not activated by default.

Activate CloudWatch Application Insights

  1. Sign in to the Systems Manager console.

  2. In the navigation pane, choose Application Manager.

  3. In Applications, search for the application name for this solution and select it.

    The application name will have App Registry in the Application Source column, and will have a combination of the solution name, Region, account ID, or stack name.

  4. In the Components tree, choose the application stack you want to activate.

  5. In the Monitoring tab, in Application Insights, select Auto-configure Application Insights.

Screenshot of Application Monitoring

Monitoring for your applications is now activated and the following status box appears:

Screenshot of Application Insights

Amazon CloudWatch metrics

This solution provides an option to create a new custom Amazon CloudWatch metric (metric name). To activate this feature, select Yes for the Enable CloudWatch Metrics CloudFormation parameter (<stackname>:InstanceScheduler).

Each time the AWS Lambda function runs, it updates the metric data for each applicable instance and then applies the appropriate start or stop action. This data includes the name of the schedule, the number of instances associated with that schedule, and the number of running instances.

View Instance Scheduler on AWS metrics

  1. In the AWS Management Console, open the Amazon CloudWatch console.

  2. In the Custom Namespaces drop-down field, choose <stackname>:InstanceScheduler.

  3. Select the schedule and service dimensions.

  4. Select the schedules and services for which you want to view the status.

  5. Under Graphed Metrics set the statstic of each selected metric to Sum and the Period to match the scheduling interval configured for the solution (default = 5, example image uses an interval of 1).

  6. At the top of the graph, select a time range to view.

Screenshot of metrics

Screenshot of metrics

Screenshot of metrics

Screenshot of metrics

Screenshot of metrics example

Screenshot of metrics example

Confirm cost tags associated with the solution

After you activate cost allocation tags associated with the solution, you must confirm the cost allocation tags to see the costs for this solution. To confirm cost allocation tags:

  1. Sign in to the Systems Manager console.

  2. In the navigation pane, choose Application Manager.

  3. In Applications, choose the application name for this solution and select it.

  4. In the Overview tab, in Cost, select Add user tag.

  5. On the Add user tag page, enter confirm, then select Add user tag.

The activation process can take up to 24 hours to complete and the tag data to appear.

Activate cost allocation tags associated with the solution

After you activate Cost Explorer, you must activate the cost allocation tags associated with this solution to see the costs for this solution. The cost allocation tags can only be activated from the management account for the organization. To activate cost allocation tags:

  1. Sign in to the AWS Billing and Cost Management and Cost Management console.

  2. In the navigation pane, select Cost Allocation Tags.

  3. On the Cost allocation tags page, filter for the AppManagerCFNStackKey tag, then select the tag from the results shown.

  4. Choose Activate.

AWS Cost Explorer

You can see the overview of the costs associated with the application and application components within the Application Manager console through integration with AWS Cost Explorer which must be first activated. Cost Explorer helps you manage costs by providing a view of your AWS resource costs and usage over time. To activate Cost Explorer for the solution:

  1. Sign in to the AWS Cost Management console.

  2. In the navigation pane, select Cost Explorer to view the solution's costs and usage over time.