AWS EC2: Start, Stop, and Terminate Instances

Disclaimer

Your use of this download is governed by Stonebranch’s Terms of Use, which are available at https://www.stonebranch.com/integration-hub/Terms-and-Privacy/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 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 6.6.0.0 and later with python options installed.

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

Software Requirements for Universal Controller

  • Universal Controller Version 6.7.0.0 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

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 /wiki/spaces/UC71x/pages/5178443 feature. Check that the/wiki/spaces/UC71x/pages/5177877 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

AWS-SECRET-ACCESS-KEY

AWS Secret Key

AWS-ACCESS-KEY-ID

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:

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.