Menu
AWS Instance Scheduler
AWS Instance Scheduler

Automated Deployment

Before you launch the automated deployment, please review the architecture, configuration, and other considerations discussed in this guide. Follow the step-by-step instructions in this section to configure and deploy Instance Scheduler into your account.

Time to deploy: Approximately five (5) minutes

What We'll Cover

The procedure for deploying this architecture on AWS consists of the following steps. For detailed instructions, follow the links for each step.

Step 1. Launch the Instance Scheduler Stack

  • Launch the AWS CloudFormation template into your AWS account

  • Enter values for the required parameter: Stack Name

  • Review the other template parameters, and adjust if necessary

Step 2. Configure Periods

  • Create a period and set the applicable fields for the period

Step 3. Configure Schedules

  • Create a schedule and set the applicable fields for the schedule

Step 4. Tag Your Instances

  • Apply the custom tag to applicable resources

Step 5. Launch the Remote Stack in Secondary Accounts (Optional)

  • Launch the AWS CloudFormation template into your AWS account

  • Enter values for the required parameter: Stack Name, Primary account

Step 1. Launch the Instance Scheduler Stack

This automated AWS CloudFormation template deploys the Instance Scheduler in AWS Lambda, and configures related components. Please make sure that you’ve verified the settings for your instances before launching the stack.

Note

You are responsible for the cost of the AWS services used while running this solution. See the Cost section for more details. For full details, see the pricing webpage for each AWS service you will be using in this solution.

  1. Sign in to the AWS Management Console and click the button below to launch the instance-scheduler AWS CloudFormation template.

    
                                Instance Scheduler launch button

    You can also download the template as a starting point for your own implementation.

  2. The template is launched in the US East (N. Virginia) Region by default. To launch the Instance Scheduler in a different AWS Region, use the region selector in the console navigation bar.

  3. On the Select Template page, verify that you selected the correct template and choose Next.

  4. On the Specify Details page, assign a name to your solution stack.

  5. Under Parameters, review the parameters for the template, and modify them as necessary.

    This solution uses the following default values.

    Parameter Default Description
    Instance Scheduler tag name Schedule

    This tag identifies instances to receive automated actions, and also allows for custom start-stop parameters.

    If you choose to modify the default value, make sure to assign a name that will be easy to apply consistently and correctly across all necessary instances.

    Service(s) to schedule EC2 The services to schedule. Select EC2, RDS, or Both.
    Scheduling enabled Yes Select No to temporarily disable scheduling.
    Region(s) <Optional input>

    List of regions where instances will be scheduled. For example, us-east-1, us-west-1.

    Note

    If you leave this parameter blank, the solution will use the current region.

    Default time zone UTC Default time zone for schedules. For a list of acceptable time zone values, see the TZ column of the List of TZ Database Time Zones.
    Cross-account roles <Optional input>

    Comma-delimited list of cross-account roles. For example, arn:aws:iam::111122223333:role/<stackname>SchedulerCrossAccountRole.

    Note

    Enter the secondary account CrossAccountRoleArn value(s) in this parameter.

    This account Yes

    Select Yes to allow the task to select resources in this account.

    Note

    If you set this parameter to No, you must configure cross-account roles.

    Frequency 5 The frequency in minutes at which the AWS Lambda function runs. Select 1, 2, 5, 10, 15, 30, or 60.
    Enable CloudWatch Metrics No Choose whether to collect data using CloudWatch Metrics for all schedules. You can override this default setting for an individual schedule when you configure it (see Step 3).

    Important

    Enabling this feature will incur charges of $0.90/month per schedule or scheduled service.

    Memory Size 128 The memory size of the solution’s main AWS Lambda function. Increase the default size to schedule a large number of Amazon EC2 and Amazon RDS instances.
    Enable CloudWatch Logs No Choose whether to log detailed information in CloudWatch Logs.
    Log retention days 30 The log retention period in days
    Started tags <Optional input> Tags to add to started instances. Use a list of tagname=tagvalue pairs.
    Stopped tags <Optional input> Tags to add to stopped instances. Use a list of tagname=tagvalue pairs.
    Send anonymous usage data Yes Send anonymous data to AWS to help us understand solution usage and related cost savings across our customer base as a whole. To opt out of this feature, select No. For more information, see the Appendix F.
  6. Choose Next.

  7. On the Options page, choose Next.

  8. On the Review page, review and confirm the settings. Be sure to check the box acknowledging that the template will create AWS Identity and Access Management (IAM) resources.

  9. Choose Create to deploy the stack.

    You can view the status of the stack in the AWS CloudFormation console in the Status column. You should see a status of CREATE_COMPLETE in roughly five (5) minutes.

Step 2. Configure Periods

When you deploy the AWS CloudFormation template, the solution creates an Amazon DynamoDB table that contains sample period rules and schedules that you can use as a reference to create your own custom period rules and schedules.

To create a period rule, you can use the Amazon DynamoDB console, the scheduler CLI, or the AWS CloudFormation custom resource. Note that if you use the custom resource to create a period, you must not use the DynamoDB console or scheduler CLI to delete or modify that period. If you do, you will create a conflict between the stored parameters in the stack and the values in the table. Also, do not use periods configured using the custom resource in schedules created using the DynamoDB console or the scheduler CLI.

To create a period rule in DynamoDB, modify one of the periods in the configuration table (ConfigTable). To create a period in the scheduler CLI, use the applicable commands. To create a period using the custom resource, add the applicable fields to the solution’s custom resource.

For an example period configuration, see Appendix E.

Step 3. Configure Schedules

To create a schedule, you can use the Amazon DynamoDB console, the scheduler CLI, or the AWS CloudFormation custom resource. Note that if you use the custom resource to create a schedule, you must not use the DynamoDB console or scheduler CLI to delete or modify that schedule. If you do, you will create a conflict between the stored parameters in the stack and the values in the table.

To create a schedule in DynamoDB, modify one of the schedules in the configuration table (ConfigTable). To create a schedule in the scheduler CLI, use the applicable commands. To create a schedule using the custom resource, add the applicable fields to the solution’s custom resource.

For an example schedule configuration, see Appendix E.

Step 4. Tag Your Instances

When you deployed the AWS CloudFormation template, you defined the name (tag key) for the solution’s custom tag. For the Instance Scheduler to recognize an Amazon EC2 or Amazon RDS instance, the tag key on that instance must match the custom tag name stored in the Amazon DynamoDB table. Therefore, it is important that you apply tags consistently and correctly to all applicable instances. You can continue to use existing tagging strategies for your instances while using this solution. For more information, see Tagging Your Amazon EC2 Resources and Tagging Your Amazon RDS Resources.

On the AWS Management Console, use the Tag Editor to apply or modify tags for multiple resources at a time. You can also apply and modify tags manually in the console.

Setting the Tag Value

As you apply a tag to a resource, use the tag key you defined during initial configuration and set the tag value to the name of a schedule to schedule that resource.

Step 5. Launch the Remote Stack in Secondary Accounts (Optional)

This automated AWS CloudFormation template configures secondary account permissions.

  1. Navigate to the AWS Instance Scheduler stack Outputs tab and copy the Value of SchedulerRole.

  2. Sign in to the AWS Management Console of the applicable secondary account and click the button to below to launch the instance-scheduler-remote AWS CloudFormation template.

    
                                Instance Scheduler remote template launch button

    You can also download the template as a starting point for your own implementation.

  3. The template is launched in the US East (N. Virginia) Region by default. To launch the Instance Scheduler in a different AWS Region, use the region selector in the console navigation bar.

  4. On the Select Template page, verify that you selected the correct template and choose Next.

  5. On the Specify Details page, assign a name to your remote stack.

  6. Under Parameters, review the parameter for the template, and modify it.

    Parameter Default Description
    Primary account <Requires Input>

    Enter the account number of the account with the primary Instance Scheduler stack. This parameter gives the solution permission to schedule Amazon EC2 and Amazon RDS instances in this account.

  7. Choose Next.

  8. On the Options page, choose Next.

  9. On the Review page, review and confirm the settings. Be sure to check the box acknowledging that the template will create AWS Identity and Access Management (IAM) resources.

  10. Choose Create to deploy the stack.

    You can view the status of the stack in the AWS CloudFormation console in the Status column. You should see a status of CREATE_COMPLETE in roughly five (5) minutes.