Deploy lab environment and Scheduler solution

In this section, we will deploy the Instance Scheduler on AWS from the AWS Solutions Library. We will also deploy a small sample fleet of EC2 instances that will be our target for the Instance Scheduler solution.

Architecture Overview

section1_01_solution

Instance Scheduler solution overview

  1. The AWS CloudFormation template provided as part of the Instance Scheduler solution sets up an Amazon EventBridge schedule rule at a user-defined interval. This rule invokes the Instance Scheduler AWS Lambda function. During configuration, users can define the AWS Regions and accounts, and a custom tag that Instance Scheduler on AWS uses to associate schedules with applicable Amazon EC2, Amazon RDS instances, and clusters.

  2. These values are stored in Amazon DynamoDB, and the Lambda function retrieves them each time it runs. You can then apply the custom tag to applicable instances.

  3. During the initial configuration of the Instance Scheduler, you can define a tag key you will use to identify applicable Amazon EC2 and Amazon RDS instances. When you create a schedule, the name you specify is used as the tag value that identifies the schedule you want to apply to the tagged resource. For example, a user might use the solution’s default tag name (tag key) “Schedule” and create a schedule called “seattle-office-hours”. To identify an instance that will use the “seattle-office-hours” schedule, the user adds the tag named “Schedule” value “seattle-office-hours” to the target EC2 instances.

Notice that, even though the Instance Scheduler solution supports the scheduling of EC2 instances and RDS instances in multiple AWS accounts and Regions, for this lab we will use the default settings of this solution for scheduling EC2 instances in a single AWS Region, us-east-1 (N. Virginia).

For more specific details about the solution, please refer to the Instance Scheduler solution implementation guidance document.

1. Log into the AWS console

This Lab only works in AWS N.Virginia region (us-east-1), while the following instructions assume that you are using your own AWS account. If you are attending an in-person workshop and were provided with an AWS account, please follow the instructions from the lab coordinator.

Sign in to the AWS Management Console as an IAM user who has either AdministratorAccess or PowerUserAccess (with full IAM access) permissions to ensure the successful execution of this lab.

2. Sample instance fleet deployment steps

With the below steps, we will deploy 6 EC2 instances. One instance will be the “walab-admin-instance” which will be used in the next sections for running the scheduler-cli tool. The other five EC2 instances will be our small sample fleet of DEV instances that we will use as the target for the Instance Scheduler solution.

  1. Download the sample_environment_template.yml CloudFormation template using the following link:

  2. Open the CloudFormation console in us-east-1 region using the following link: https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/new

  3. Click on Upload a template file, and then on Choose file. Select the template file downloaded in step 1, named “sample_environment_template.yml”. Click on Next.

section1_1_sampleenvstack

  1. For the Stack name, use walab-l200-scheduling-sample-env. Leave other parameters as default and click on the Next button until you get to the Review page.

  2. In the Review page, scroll down, check the “I acknowledge that AWS CloudFormation might create IAM resources." box and click on the Submit button.

section1_2_sampleenvstack

While the walab-l200-scheduling-sample-env stack is being deployed. Continue with the below steps to deploy the Instance Scheduler on AWS solution.

3. Instance Scheduler installation steps

  1. Use below link to automatically open this solution template in your CloudFormation console in us-east-1 region:

  2. Click on the Next button.

  3. For the Stack name, use InstanceScheduler. Leave all other parameters as default.

    Important: Use this exact name as will need it later to see the configuration of the schedules.

    Click here to learn more about some of the main parameters we are leaving as default.
  4. Scroll down and click on the Next button until you get to the Review page.

  5. In the Review page, scroll down, check the “I acknowledge that AWS CloudFormation might create IAM resources." box and click on the Submit button.

  6. Finally, go back to the CloudFormation Stacks console and wait for both stacks walab-l200-scheduling-sample-env and InstanceScheduler to be in a “CREATE_COMPLETE” status. This might take up to 5 minutes to complete.

section1_3_sampleenvstack

Congratulations!

You have now completed the first section of the lab.

You should have a working lab environment which we will use for the remainder sections of the lab.

Click on Next Step to continue with the next section.