Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

You can use the Amazon EC2 Instance to start, stop or reboot provisioned Amazon Elastic Compute Cloud (Amazon EC2) instances on demand, e.g. only when needed by the build itself (development) or at specific times of the day (operations).



Configuration

Tip

Cloud native alternative via AWS CloudFormation

AWS has published a cloud native AWS Instance Scheduler solution that can be deployed into a single region with the AWS CloudFormation Stack task and then also allows to start and stop instances in secondary accounts:

“The AWS Instance Scheduler is a simple AWS-provided solution that enables customers to easily configure custom start and stop schedules for their Amazon Elastic Compute Cloud (Amazon EC2) and Amazon Relational Database Service (Amazon RDS) instances.”

Info

Creating/Terminating Instances

We currently consider instance lifecycle goals (i.e. create/terminate) to be sufficiently addressed by the AWS CloudFormation Stack task, hopefully covering the majority of use cases (please let us know otherwise).

To configure an Amazon EC2 Instance task:

1. Navigate to the Tasks configuration tab for the job (this will be the default job if creating a new plan).

2. Click the name of an existing Amazon EC2 Instance task, or click Add Task and then Amazon EC2 Instance Task to create a new task.

3. Complete the following settings:

a. Common to all tasks

Include Page
_CommonTaskParametersTable
_CommonTaskParametersTable

b. Actions supported by this task:

Start Instance(s)


Instance ID

(Optional) Specify one or more instance IDs (semicolon separated).

Filters

(Optional) Specify resource filters in JSON format. Insert fragments from the inline Examples dialog to get started.

Don't fail for empty filter result

Check to prevent the task failing if no matching resources are found.

Stop Instance(s)

Instance ID

see Start Instance(s) above

Filters

see Start Instance(s) above

Don't fail for empty filter result

see Start Instance(s) above

Force stop

Check to force the instances to stop.

  • (warning) The instances do not have an opportunity to flush file system caches or file system metadata. If you use this option, you must perform file system check and repair procedures.This option is not recommended for Windows instances.

Hibernate

Check to hibernate the instance instead of shutting it down.

Reboot Instance(s)

Instance ID

see Start Instance(s) above

Filters

see Start Instance(s) above

Don't fail for empty filter result

see Start Instance(s) above

Variables

Include Page
_VariablesNote
_VariablesNote

Start Instance(s)

Code Block
languagetext
Creating common variables for 1 resources affected by task:
... custom.aws.ec2.instance.resources: i-a316b842
Creating resource variables for instance 'i-a316b842':
... custom.aws.ec2.instance.resources.i-a316b842.InstanceId: i-a316b842
... custom.aws.ec2.instance.resources.i-a316b842.State: running
... custom.aws.ec2.instance.resources.i-a316b842.PrivateDnsName: ip-10-0-0-241.ec2.internal
... custom.aws.ec2.instance.resources.i-a316b842.PrivateIpAddress: 10.0.0.241
... custom.aws.ec2.instance.resources.i-a316b842.PublicDnsName:
... custom.aws.ec2.instance.resources.i-a316b842.PublicIpAddress: null
... custom.aws.ec2.instance.resources.i-a316b842.LaunchTime: 20150716T080402Z
... custom.aws.ec2.instance.resources.i-a316b842.tags: Name
... custom.aws.ec2.instance.resources.i-a316b842.tags.Name: taws-it-2.0.0
Creating common variables for first resource affected by task:
Creating resource variables for instance 'i-a316b842':
... custom.aws.ec2.instance.first.InstanceId: i-a316b842
... custom.aws.ec2.instance.first.State: running
... custom.aws.ec2.instance.first.PrivateDnsName: ip-10-0-0-241.ec2.internal
... custom.aws.ec2.instance.first.PrivateIpAddress: 10.0.0.241
... custom.aws.ec2.instance.first.PublicDnsName:
... custom.aws.ec2.instance.first.PublicIpAddress: null
... custom.aws.ec2.instance.first.LaunchTime: 20150716T080402Z
... custom.aws.ec2.instance.first.tags: Name
... custom.aws.ec2.instance.first.tags.Name: taws-it-2.0.0

Stop Instance(s)

Expand
Code Block
languagetext
Creating common variables for 1 resources affected by task:
... custom.aws.ec2.instance.resources: i-a316b842
Creating resource variables for instance 'i-a316b842':
... custom.aws.ec2.instance.resources.i-a316b842.InstanceId: i-a316b842
... custom.aws.ec2.instance.resources.i-a316b842.State: stopped
... custom.aws.ec2.instance.resources.i-a316b842.PrivateDnsName: ip-10-0-0-241.ec2.internal
... custom.aws.ec2.instance.resources.i-a316b842.PrivateIpAddress: 10.0.0.241
... custom.aws.ec2.instance.resources.i-a316b842.PublicDnsName:
... custom.aws.ec2.instance.resources.i-a316b842.PublicIpAddress: null
... custom.aws.ec2.instance.resources.i-a316b842.LaunchTime: 20150716T080402Z
... custom.aws.ec2.instance.resources.i-a316b842.tags: Name
... custom.aws.ec2.instance.resources.i-a316b842.tags.Name: taws-it-2.0.0
Creating common variables for first resource affected by task:
Creating resource variables for instance 'i-a316b842':
... custom.aws.ec2.instance.first.InstanceId: i-a316b842
... custom.aws.ec2.instance.first.State: stopped
... custom.aws.ec2.instance.first.PrivateDnsName: ip-10-0-0-241.ec2.internal
... custom.aws.ec2.instance.first.PrivateIpAddress: 10.0.0.241
... custom.aws.ec2.instance.first.PublicDnsName:
... custom.aws.ec2.instance.first.PublicIpAddress: null
... custom.aws.ec2.instance.first.LaunchTime: 20150716T080402Z
... custom.aws.ec2.instance.first.tags: Name
... custom.aws.ec2.instance.first.tags.Name: taws-it-2.0.0

Reboot Instance(s)

N/A

How-to Articles

Filter by label (Content by label)
max8
showSpacefalse
sorttitle
excerptTypesimple
cqllabel in ( "aws-cli" , "amazon-ec2" ) and label in ( "kb-how-to-article" , "kb-troubleshooting-article" )

Frequently Asked Questions (FAQ)

Include Page
UAA:_FAQHeaderQuestionsForConfluence
UAA:_FAQHeaderQuestionsForConfluence
Questionslist macro
filterpopular
asktrue
limit8
topicamazon-ec2