AWS – You can now use Instance Scheduler to configure automatic start and stop of your EC2 instances

As you know, running workloads on cloud services requires to implement cost management and optimization to not get nasty surprises with your consumption bills.

One of the solution applicable to your virtual machines is to automatically start and stop them to match your business need.

To start using AWS Instance Scheduler with your EC2 instances, get the templates for your CloudFormation:

  • instance-scheduler.template to launch the Instance Scheduler and all associated components. The default configuration deploys an AWS Lambda function, an Amazon DynamoDB table, an Amazon CloudWatch event, and CloudWatch custom metrics, but you can also customize the template based on your needs
  • instance-scheduler-remote.template if you want to configure permissions for secondary accounts. The default configuration creates the AWS Identity and Access Management (IAM) roles necessary to start and stop instances in a secondary account.

Then connect to your AWS console (https://console.aws.amazon.com/) to access your CloudFormation stack.

image_thumb

Then create (or edit) a stack by either uploading your templates (from above links) or providing link to the S3 URL

image_thumb[1]

Then define the various stack parameters; you may have to update the default time zone.

The stack creation process will create few new resources, such as 2 new IAM roles (SchedulerRole and instanceschedulerlambdaLambdaFunctionServiceRole<id>), a new IAM policy (EC2DynamoDBPolicy) or a new DynamoDB table (ConfigTable).

Then you can edit the Config table of the DynamoDB database to edit the period and schedule items to match your requirements (starting time, timezone…)

image_thumb[2]

Your CloudFormation stack is now ready to be used for resource deployment.

Benoit Hamet
Benoit Hamet
Benoit is working on Microsoft collaborative technologies He has been awarded as MVP for more than 12 years Currently MVP on Office 365 after being awarded on SharePoint (2011-2012) and Windows client & server (2002-2007) Speaker at various Microsoft events (TechDays, TechNet seminars) and Quest Software He works on on-premises (Active Directory, RADIUS/NPS, Exchange, Skype for Business, SharePoint, SQL, Terminal Server, Windows client and Windows Server) or online (Azure, Intune, Office 365, Exchange Online, SharePoint Online, Skype for Business Online, Teams) technologies