AWS EC2: Start, Stop, and Terminate Instances

AWS EC2: Start, Stop, and Terminate Instances

CUSTOMER GENERIC

Disclaimer

Your use of this download is governed by Stonebranch’s Terms of Use.

Introduction

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. 

Overview

  • 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, Stopped, or terminated.

  • Scheduling this task using a 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 a 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 3.7 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 7.5 and later with python options installed.

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

Software Requirements for Universal Controller

  • Universal Controller Version 7.5. and later..

Technical Considerations

  • Consider using this Universal Task either with Universal Agent bundled with python (uapy) and also the boto3 module within this environment, or a python environment (py) in a host where Universal Agent is installed with the 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

Feature

Description

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

Field

Description

AWS-DEFAULT-REGION

AWS Region kept as Credential.

Use IAM RoleCheck the box to use IAM role.

AWS-SECRET-ACCESS-KEY

AWS Secret Key.

AWS-ACCESS-KEY-ID

AWS Access Key.

loglevelLog level of the task (set to "Info" by default).

EC2 Instance Function

Select either Start, Stop, Terminate, or Check EC2 Instance.

InstanceIds

Provide the Instance ID that you need to start, stop, or terminate.


Task Examples

Start EC2 Instances

Stop EC2 Instances


Document References

This document references the following documents:

Name

Description

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.


Changelog

ut-cs-aws-start-stop-terminate-ec2-instance-1.2.0 (2025-10-27)

Enhancements

  • Added:  inclusion IAM Roles based auth


ut-cs-aws-start-stop-terminate-ec2-instance-1.1.2 (2022-03-25)

Enhancements

  • Added:  Display the EC2 Instance JSON payload in STDOUT


ut-cs-aws-start-stop-terminate-ec2-instance-1.0.0

Initial Release