Stopping EC2 Instances Every Evening

If you're just getting started with AWS, try creating your first EC2 instance using this this tutorial.

We will now create our first workflow. Ensure that your AWS account has been successfully connected to TotalCloud (either through a Role or Key), before getting started.

Forgetting to shut down instances can be the cause of unexpected increases in billing amounts. To counter this, we will be creating a workflow to stop all EC2 instances every evening.

  1. Click on the Editor to start making the workflow. Choose Create workflow from scratch.
This workflow also exists as a template, in case you want to deploy it quickly. Search for it in the templates section, and then deploy it.

.

  1. Click on the Trigger Node, and select Edit.
    1. Choose 'schedule', and select all the days of the week.
    2. Set the time as 19:00 and click 'Save'.
    3. This will cause the workflow to trigger at 7:00PM everyday.
The time being referred to here is UTC

.

  1. Click the '+' sign to open a new node.
    1. Select 'Resource' from the list. Click on the Node and select edit.
    2. Select 'EC2' as the service and 'Instances' as the resource, and click 'Save'.
    3. This will pull data on all EC2 Instances.

.

  1. Click the '+' again, and select 'Filter'
    1. Edit the node, and select the reference to the previous node in the 'Select data to filter' drop-down.
    2. Select 'Param' as filter type, enter 'State.Name' as Key, '==' as operator, and value as running.
    3. Click 'Save'. This will ensure that all the running instances are passed through this filter.

.

  1. Clicking '+', open an Action Node.
    1. Select the '...filter.instances' on from the top drop-down for the node to perform action on.
    2. Choose 'EC2' as the service and 'Stop Instances' as the action.

.

  1. Open a Notification Node, and select the method of notification (email or Slack). Click Save.

.

  1. Choose the AWS Account to use, and the region to run the workflow in.

.

  1. Click Run on the top-right of the Editor to save and run your workflow.

Did You Find This Article Helpful?

Create Workflows From Scratch

Workflow Policy Validation

Powered by HelpDocs