CmdID

CmdID / aws / aws ec2

aws ec2 stop-instances

Stops an Amazon EBS-backed instance. AWS CLI reference

2 examples 5 options Its page in the AWS CLI reference

Opens CmdID with your command. It is read in your browser and sent nowhere.

Examples

from aws-cli, each command read by CmdID

Example 1: To stop an Amazon EC2 instance

The following stop-instances example stops the specified Amazon EBS-backed instance.

aws ec2 stop-instances --instance-ids i-1234567890abcdef0Identify
--instance-idsThe IDs of the instances.
Its output
{
    "StoppingInstances": [
        {
            "InstanceId": "i-1234567890abcdef0",
            "CurrentState": {
                "Code": 64,
                "Name": "stopping"
            },
            "PreviousState": {
                "Code": 16,
                "Name": "running"
            }
        }
    ]
}

For more information, see Stop and Start Your Instance in the Amazon Elastic Compute Cloud User Guide.

Example 2: To hibernate an Amazon EC2 instance

The following stop-instances example hibernates Amazon EBS-backed instance if the instance is enabled for hibernation and meets the hibernation prerequisites. After the instance is put into hibernation the instance is stopped.

aws ec2 stop-instances --instance-ids i-1234567890abcdef0 --hibernateIdentify
--instance-idsThe IDs of the instances.
--hibernateHibernates the instance if the instance was enabled for hibernation at launch.
Its output
{
    "StoppingInstances": [
        {
            "CurrentState": {
                "Code": 64,
                "Name": "stopping"
            },
            "InstanceId": "i-1234567890abcdef0",
            "PreviousState": {
                "Code": 16,
                "Name": "running"
            }
        }
    ]
}

For more information, see Hibernate your On-Demand Linux instance in the Amazon Elastic Cloud Compute User Guide.

Options

5 in the AWS CLI reference
--dry-runChecks whether you have the required permissions for the operation, without actually making the request, and provides an error response.
--forceForces the instance to stop.
--hibernateHibernates the instance if the instance was enabled for hibernation at launch.
--instance-idsThe IDs of the instances.
--skip-os-shutdownSpecifies whether to bypass the graceful OS shutdown process when the instance is stopped.