AWS EC2: Start, Stop, and Terminate Instances


Your use of this download is governed by Stonebranch’s Terms of Use, which are available at


This Universal Task allows users to start, stop, terminate, and manage AWS EC2 instances on demand, simply by providing one or more instance IDs as input. 


  • This task uses python boto3 to interact with the AWS platform using the credentials supplied within the task.

  • It supports multiple EC2 instances at once.

  • In Universal Controller this task goes to the success state until the EC2 instance is completely Started or Stopped or terminated.

  • Scheduling this task using Universal Controller workflow spins up and tears down EC2 instances based on the business needs, complete with correct set up and dependencies. 

  • It dynamically manages EC2 operations, offering the potential to reduce EC2 operations costs in the cloud. 

Software Requirements

This integration requires an Universal Agent and a Python runtime to execute the Universal Task against AWS EC2 Instance.

Software Requirements for Universal Template and Universal Task

  • Requires Python 2.7 or Python 3.6 or higher. Tested with the Universal Agent bundled Python distribution.

  • Python modules required.

    • requests

    • Boto3

Software Requirements for Universal Agent

  • Universal Agent for Windows x64 Version and later with python options installed.

  • Universal Agent for Linux Version and later with python options installed.

Software Requirements for Universal Controller

  • Universal Controller Version and later.

Software Requirements for the Application to be Scheduled

  • The Server Running the Universal Agent needs to have Python 2.7.x or 3.6.x installed.

  • AWS programmatic Credentials -Access Key, Secret Access key and Region.

  • This Universal Task for the AWS EC2-start-stop-terminate has been tested with the agent bundled with python 3.6 and boto3 module.

Technical Considerations

  • Consider using this Universal Task either with universal agent bundled with python(uapy) and also having boto3 module within this environment or a python environment (py) in a host where Universal Agent is installed with boto3 module in it.

  • AWS IAM credentials (Access Key, Secret Access key and Region) should be with the appropriate access for handling AWS EC2 instances.

Key Features



Start EC2 Instance

Start one or Multiple EC2 instance

Stop EC2 Instance

Stops one or Multiple EC2 instance

Terminate EC2 Instance

Terminate one or Multiple EC2 instance

EC2 status

Provides one or Multiple EC2 instance status

Import Universal Template

To use this downloadable Universal Template, perform the following steps.

  1. This Universal Task requires the Resolvable Credentials feature. Check that the Resolvable Credentials Permitted system property has been set to true.

  2. To import the Universal Template into your Controller, follow the instructions here.
  3. When the files have been imported successfully, refresh the Universal Templates list; the Universal Template will appear on the list.

Configure Universal Task

For the new Universal Task type, create a new task, and enter the task-specific details that were created in the Universal Template.

Field Descriptions




AWS Region kept as credential


AWS Secret Key


AWS Access Key

EC2 Instance Function

Select either start or stop or terminate or check ec2 instance

Instance ID’s

Provide the Instance ID which you would need to start or stop or term

Task Examples

Start EC2 Instances

Stop EC2 Instances

Document References

This document references the following documents:



Universal Templates

User documentation for creating Universal Templates in the Universal Controller user interface.

Universal Tasks

User documentation for creating Universal Tasks in the Universal Controller user interface.