Use AWS Instance Scheduler to Shut Down an EC2 instance

1 hour
  • 6 Learning Objectives

About this Hands-on Lab

In this hands-on lab, we will deploy the AWS Instance Scheduler solution to shut down an EC2 instance based on a custom schedule we will create. Instance Scheduler can help you save money and provide cost optimization for workloads.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Deploy AWS Instance Scheduler
  1. Navigate to the AWS Instance Scheduler.
  2. Click Launch solution in the AWS Console.
  3. In the CloudFormation console, enter a name for our CloudFormation stack.
  4. Add tags:
    • started-by=InstanceScheduler
    • stopped-by=InstanceScheduler
Edit the DynamoDB Tables
  1. Navigate to DynamoDB > Tables.
  2. elect the ConfigTable.
  3. Select the uk-office-hours item.
  4. Click Actions > Duplicate.
  5. Change the description to "Office hours in US".
  6. Change the string to "us-office-hours".
  7. Change the time zone to "US/Eastern".
  8. Click Save and then refresh the table.
Add Tag to EC2 Instance
  1. Navigate to EC2 > Instances.
  2. Select the running instance.
  3. Add the following tag:
    • Key: Schedule
    • Value: us-office-hours
  4. Click Save.
Update CloudWatch Events Rule
  1. Navigate to CloudWatch > Rules.
  2. Select the listed rule.
  3. Click Actions > Edit.
  4. Under Event Source, select Fixed rate of.
  5. In the box, enter "1".
  6. From the dropdown, select Minutes.
  7. Click Configure details.
  8. Click Update rule.
Update DynamoDB Config Table
  1. Navigate to DynamoDB > Tables.
  2. Click the ConfigTable.
  3. Update the endtime so the business day ends five minutes from your current time (e.g., if it’s 8 AM where you are right now, change the endtime to 08:05.)
  4. Click Save.
Verify EC2 Instance Stopped
  1. Navigate to EC2 > Instances.
  2. Verify our EC2 instance has stopped.

Additional Resources

As the senior engineer, you have been tasked with architecting a solution to turn off EC2 instances when they are not being used, especially after business hours. You have decided to use the AWS Instance Scheduler solution to automatically turn off your EC2 instances after business hours so your account receives an immediate cost savings each night.

The AWS Instance Scheduler link can be found here: https://aws.amazon.com/solutions/instance-scheduler/

To get started, log in to the live AWS environment using the credentials provided. Make sure you're in the N. Virginia (us-east-1) region throughout the lab.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Get Started
Who’s going to be learning?

How many seats do you need?

  • $499 USD per seat per year
  • Billed Annually
  • Renews in 12 months

Ready to accelerate learning?

For over 25 licenses, a member of our sales team will walk you through a custom tailored solution for your business.


$2,495.00

Checkout
Sign In
Welcome Back!
Thanks for reaching out!

You’ll hear from us shortly. In the meantime, why not check out what our customers have to say about ACG?