EC2: Stop Instance

Overview

The "EC2: Stop Instance" action allows you to stop a running Amazon EC2 instance (hereafter "EC2 instance").Like other actions, you can specify EC2 instance by resource ID or the tag attached to EC2 instance.

Setting options

No. Option Description
1 Region Select the AWS region from the list where the EC2 instance you want to stop is located
2 Instance Select the EC2 instance you want to stop by resource ID from the list
When "Can't find any instances in this region or aws account" is showing in the list, please verify whether AWS account and region are correctly selected
Instance with specific tag Specify the EC2 instance you want to stop by entering key and value to use tags. All EC2 instances in the specified region that have a tag that matches the entered key and value will be the target.
3 Verify completion status of the resource after job execution
  • When verifying completion status of the resource after job execution
    • When the StopInstances API request is successful and the status of the stopped EC2 instance is stopped, the job is determined to have succeeded (note that this is not a status check)
    • When the StopInstances API request is successful and the status of the stopped EC2 instance is other than stopped, it is determined that the job has failed

    ※The status of EC2 instances is checked at approximately 1-minute intervals using the DescribeInstances API

  • When not verifying completion status of the resource after job execution

 

Setting example

Create a job with the "EC2: Stop Instance" action using Cloud Automator.

  1. Click the "Add Job" button on the operation job screen of Cloud Automator.

  2. Select the group to which the job will belong
  3. In the trigger selection, select any trigger

  4. In the action selection, select the "EC2: Stop Instance" action

  5. In the AWS account selection, select any AWS account

  6. Configure the action parameters

    No. Option Setting value example
    1 Region ap-northeast-1
    2 Instance with specific tag

    key: Environment

    value: Development

    3 Verify completion status of the resource after job execution Check
    en.png
  7. Set post-processing for success and failure

  8. Enter the job name and click "Create"

Operation check

Check the created job.

  1. Click the log button for the created job.

  2. Click the details of the corresponding execution log from the execution log list.

  3. Check the results in the log details. If it shows "Success", you can confirm that the corresponding job has been executed and succeeded. If it shows "Running", the job is still running, so please wait a while before checking again.

  4. The operation result of each resource can be confirmed by clicking "Show Details"

This completes the operation check of the job using the "EC2: Stop Instance" action. The "EC2: Stop Instance" action can be used more extensively by combining it with other actions.

Please check Cloud Automator Tips for specific usage examples.

 

Log status conditions

When verifying completion status of the resource after job execution

Job execution result Condition
Success When the StopInstances API request is successful and the status of the stopped EC2 instance is stopped
Failure
  • When the EC2 instance specified in the job does not exist
  • When the number of EC2 instances specified in the job exceeds 200
  • When the StopInstances API request fails, or when the status of the stopped EC2 instance becomes something other than stopped (such as running)

 

When not verifying completion status of the resource after job execution

Job execution result Condition
Success When the StopInstances API request is successful
Failure
  • When the EC2 instance specified in the job does not exist
  • When the number of EC2 instances specified in the job exceeds 200
  • When the StopInstances API request fails

 

Resource operation history status conditions

When verifying completion status of the resource after job execution

Resource operation result Condition
Completed When the StopInstances API request is successful and the status of the stopped EC2 instance is stopped
Failed When the StopInstances API request fails, or when the status of the stopped EC2 instance becomes something other than stopped (such as running)

 

When not verifying completion status of the resource after job execution

Resource operation result Condition
Completed When the StopInstances API request is successful
Failed When the StopInstances API request fails

 

AWS API used in this action

The following AWS APIs are used for the execution of this action.
The AWS account that executes this action must have an IAM policy that allows execution of these APIs attached.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request