Amazon Elastic Compute Cloud
User Guide (API Version 2013-02-01)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Go to the Kindle Store to download this guide in Kindle format.Did this page help you?  Yes | No |  Tell us about it...

Obtaining Information About the Instances Launched by Auto Scaling

You can use the Auto Scaling CLI tools to obtain information about your launch configuration, Auto Scaling groups and Amazon EC2 instances launched by Auto Scaling.

In this section, we will use the following Auto Scaling CLI commands to get information about the Spot price bids and Spot Instances that Auto scaling makes and launches for you.

  • as-describe-scaling-activities—You can use the information about Auto Scaling activities that this command returns to check the status of the bids submitted for you by Auto Scaling.

  • as-describe-auto-scaling-groups—You can use the information about Auto Scaling groups that this command returns to confirm that Auto Scaling is launching your Spot Instances according to your specifications.

To check the status of the bids that Auto Scaling is making for you

The as-describe-scaling-activities command lists the activities that Auto Scaling performed for a specified Auto Scaling group.

This is the basic syntax:

as-describe-scaling-activities [ActivityIds [ActivityIds ...]] [--auto-scaling-group value] [--max-records value] [General Options]

Specifying the Auto Scaling group and the Activity ID are optional. If you don't specify the Auto Scaling group, the command will return all activities for all Auto Scaling groups associated with your account. If you specify the Auto Scaling group, only the activities for that Auto Scaling group will be listed.

In this scenario, we are using the as-describe-scaling-activities command to see state of your bid. Assume that there is only one Auto Scaling group (spotasg) and you want to list all activities.

  1. Open a command line and navigate to the bin folder of your Auto Scaling CLI tools directory.

  2. Type the command: as-describe-scaling-activities --auto-scaling-group spotasg --headers

    The information you get should be similar to the following example.

    ACTIVITY  ACTIVITY-ID                           END-TIME              GROUP-NAME  CODE                      MESSAGE
    ACTIVITY  31bcbb67-7f50-4b88-ae7e-e564a8c80a90                        spotasg     WaitingForSpotInstanceId  Placed Spot instance request: sir-fc8a3014. Waiting for instance(s)
    ACTIVITY  770bbeb5-407c-404c-a826-856f65db1c57                        spotasg     WaitingForSpotInstanceId  Placed Spot instance request: sir-69101014. Waiting for instance(s)
    ACTIVITY  597e4ebd-220e-42bc-8ac9-2bae4d20b8d7  2012-05-23T17:40:22Z  spotasg     Successful                                                                                   
    

    In this response, you know that your bids were placed, one of the bids is successful, and Auto Scaling is waiting for the other two bids.

    Note

    If the as-describe-scaling-activities command returns a list that includes Failed activities, check the data you specified in the launch configuration. For example:

    • The Amazon Machine Image (AMI) might not be valid anymore.

    • The bid price specified in the launch configuration is lower than the Spot market price.

  3. If you run the as-describe-scaling-activities command again later, you can be getting information that is similar to the following example:

    ACTIVITY  ACTIVITY-ID                           END-TIME              GROUP-NAME      CODE      
    ACTIVITY  90630906-b40f-41a6-967a-cd6534b2dfca  2012-06-01T02:32:15Z  spotasg         Successful
    ACTIVITY  a1139948-ad0c-4600-9efe-9dab8ce23615  2012-06-01T00:48:02Z  spotasg         Successful
    ACTIVITY  33001e70-6659-4494-a817-674d1b7a2f58  2012-06-01T02:31:11Z  spotasg         Successful
    

    The output shows that the listed activities were successful. Because we know that spotasg is an Auto Scaling group that uses a launch configuration with a spot bid price, you can assume that the activities represent the bids placed by Auto Scaling.

  4. If you want to get more details about the activities and instances, use the --show-xml option of as-describe-scaling-activities. Enter the following command as-describe-scaling-activities --auto-scaling-group spotasg --show-xml.

    The information you get should be similar to the following example.

    <DescribeScalingActivitiesResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">
      <DescribeScalingActivitiesResult>
        <NextToken>b5a3b43e-10c6-4b61-8e41-2756db1fb8f5</NextToken>
        <Activities>
          <member>
            <StatusCode>Successful</StatusCode>
            <Progress>0</Progress>
            <ActivityId>90630906-b40f-41a6-967a-cd6534b2dfca</ActivityId>
            <StartTime>2012-06-01T00:48:21.942Z</StartTime>
            <AutoScalingGroupName>spotasg</AutoScalingGroupName>
            <Cause>At 2012-06-01T00:48:21Z a difference between desired and actual capacity changing the desired capacity, increasing the capacity from 2 to 3.</Cause>
            <Details>{}</Details>
            <Description>Launching a new EC2 instance: i-fe30d187</Description>
            <EndTime>2012-06-01T02:32:15Z</EndTime>
          </member>
          <member>
            <StatusCode>Successful</StatusCode>
            <Progress>0</Progress>
            <ActivityId>a1139948-ad0c-4600-9efe-9dab8ce23615</ActivityId>
            <StartTime>2012-06-01T00:47:51.293Z</StartTime>
            <AutoScalingGroupName>spotasg</AutoScalingGroupName>
            <Cause>At 2012-06-01T00:47:51Z an instance was taken out of service in response to a system health-check.</Cause>
            <Details>{}</Details>
            <Description>Terminating EC2 instance: i-88ce28f1</Description>
            <EndTime>2012-06-01T00:48:02Z</EndTime>
          </member>
          <member>
            <StatusCode>Successful</StatusCode>
            <Progress>0</Progress>
            <ActivityId>33001e70-6659-4494-a817-674d1b7a2f58</ActivityId>
            <StartTime>2012-06-01T00:46:19.723Z</StartTime>
            <AutoScalingGroupName>spotasg</AutoScalingGroupName>
            <Cause>At 2012-06-01T00:46:19Z a difference between desired and actual capacity changing the desired capacity, increasing the capacity from 2 to 3.</Cause>
            <Details>{}</Details>
            <Description>Launching a new EC2 instance: i-2c30d155</Description>
            <EndTime>2012-06-01T02:31:11Z</EndTime>
          </member>
          ...
        </Activities>
      </DescribeScalingActivitiesResult>
      <ResponseMetadata>
        <RequestId>d02af4bc-ad8f-11e1-85db-83e1968c7d8d</RequestId>
      </ResponseMetadata>
    </DescribeScalingActivitiesResponse>
    

    The XML output shows more detail about the Spot and Auto Scaling activity.

    • Cause: At 2012-06-01T00:48:21Z a difference between desired and actual capacity changing the desired capacity, increasing the capacity from 2 to 3. Description: Launching a new EC2 instance: i-fe30d187

      If an instance is terminated and the number of instances falls below the desired capacity, Auto Scaling will launch a new instance so that the total number of your running instances rises back to the level specified for desired capacity.

    • Cause: At 2012-06-01T00:47:51Z an instance was taken out of service in response to a system health-check. Description: Terminating EC2 instance: i-88ce28f1

      Auto Scaling maintains the desired number of instances by monitoring the health status of the instances in the Auto Scaling group. When Auto Scaling receives notification that an instance is unhealthy or terminated, Auto Scaling launches another instance to take the place of the unhealthy instance. For information about how Auto Scaling monitors the health status of instances, go to Maintaining Current Scaling Level in the Auto Scaling Developer Guide.

      Note

      Auto Scaling provides the cause of instance termination that is not the result of a scaling activity. This includes instances that have been terminated because the Spot market price exceeded their bid price.

      When Auto Scaling attempts to replace terminated instances resulting from the Spot market price rising above the instances' bid price, Auto Scaling will place the bid specified in the current launch configuration and attempt to launch another instance to maintain the desired capacity.

To confirm that Auto Scaling is launching your Spot Instances according to your specifications

Use as-describe-auto-scaling-groups. The command will show details about the group and instances launched. For information about the as-describe-auto-scaling-groups command, see Verify Auto Scaling Group Creation in the Auto Scaling Developer Guide.

  1. Open a command line and navigate to the bin folder of your Auto Scaling CLI tools directory.

  2. Type the command:as-describe-auto-scaling-groups spotasg --headers

    Note

    The --headers option supplies the column name so you know what data is being returned.

    The information you get should be similar to the following example.

    AUTO-SCALING-GROUP  GROUP-NAME      LAUNCH-CONFIG  AVAILABILITY-ZONES     MIN-SIZE  MAX-SIZE  DESIRED-CAPACITY
    AUTO-SCALING-GROUP  spotasg         spotlc-5cents  us-east-1b,us-east-1a  1         5         3               
    INSTANCE  INSTANCE-ID  AVAILABILITY-ZONE  STATE      STATUS   LAUNCH-CONFIG
    INSTANCE  i-2c30d155   us-east-1a         InService  Healthy  spotlc-5cents
    INSTANCE  i-fe30d187   us-east-1a         InService  Healthy  spotlc-5cents
    INSTANCE  i-c630d1bf   us-east-1a         InService  Healthy  spotlc-5cents
    

    You can see that Auto Scaling launched 3 instances in us-east-1a, as you specified, and they are all running.

  3. Additionally, you can find out details about the Spot Instances launched for you by Auto Scaling, by using the as-describe-auto-scaling-instances command.

    This is the basic syntax:

    as-describe-auto-scaling-instances [InstanceIds [InstanceIds ...]] [--max-records value] [General Options]

    Specifying InstanceIds is optional. If you specify it, the command will return information about the instance, if it exists. If you don't specify InstanceIds, the command returns information about all instances associated with your Auto Scaling account.

    In this walkthrough, we are assuming that you created one launch configuration and Auto Scaling group, and you want to find out details about all your Spot Instances.

    Your command should look like the following example:

    as-describe-auto-scaling-instances --headers

    The information you get should be similar to the following example:

    INSTANCE  INSTANCE-ID  GROUP-NAME      AVAILABILITY-ZONE  STATE      STATUS   LAUNCH-CONFIG
    INSTANCE  i-2c30d155   spotasg         us-east-1a         InService  HEALTHY  spotlc-5cents
    INSTANCE  i-c630d1bf   spotasg         us-east-1a         InService  HEALTHY  spotlc-5cents
    INSTANCE  i-fe30d187   spotasg         us-east-1a         InService  HEALTHY  spotlc-5cents
    

What do you want to do next?