EMR / Client / list_instance_groups

list_instance_groups#

EMR.Client.list_instance_groups(**kwargs)#

Provides all available details about the instance groups in a cluster.

See also: AWS API Documentation

Request Syntax

response = client.list_instance_groups(
    ClusterId='string',
    Marker='string'
)
Parameters:
  • ClusterId (string) –

    [REQUIRED]

    The identifier of the cluster for which to list the instance groups.

  • Marker (string) – The pagination token that indicates the next set of results to retrieve.

Return type:

dict

Returns:

Response Syntax

{
    'InstanceGroups': [
        {
            'Id': 'string',
            'Name': 'string',
            'Market': 'ON_DEMAND'|'SPOT',
            'InstanceGroupType': 'MASTER'|'CORE'|'TASK',
            'BidPrice': 'string',
            'InstanceType': 'string',
            'RequestedInstanceCount': 123,
            'RunningInstanceCount': 123,
            'Status': {
                'State': 'PROVISIONING'|'BOOTSTRAPPING'|'RUNNING'|'RECONFIGURING'|'RESIZING'|'SUSPENDED'|'TERMINATING'|'TERMINATED'|'ARRESTED'|'SHUTTING_DOWN'|'ENDED',
                'StateChangeReason': {
                    'Code': 'INTERNAL_ERROR'|'VALIDATION_ERROR'|'INSTANCE_FAILURE'|'CLUSTER_TERMINATED',
                    'Message': 'string'
                },
                'Timeline': {
                    'CreationDateTime': datetime(2015, 1, 1),
                    'ReadyDateTime': datetime(2015, 1, 1),
                    'EndDateTime': datetime(2015, 1, 1)
                }
            },
            'Configurations': [
                {
                    'Classification': 'string',
                    'Configurations': {'... recursive ...'},
                    'Properties': {
                        'string': 'string'
                    }
                },
            ],
            'ConfigurationsVersion': 123,
            'LastSuccessfullyAppliedConfigurations': [
                {
                    'Classification': 'string',
                    'Configurations': {'... recursive ...'},
                    'Properties': {
                        'string': 'string'
                    }
                },
            ],
            'LastSuccessfullyAppliedConfigurationsVersion': 123,
            'EbsBlockDevices': [
                {
                    'VolumeSpecification': {
                        'VolumeType': 'string',
                        'Iops': 123,
                        'SizeInGB': 123,
                        'Throughput': 123
                    },
                    'Device': 'string'
                },
            ],
            'EbsOptimized': True|False,
            'ShrinkPolicy': {
                'DecommissionTimeout': 123,
                'InstanceResizePolicy': {
                    'InstancesToTerminate': [
                        'string',
                    ],
                    'InstancesToProtect': [
                        'string',
                    ],
                    'InstanceTerminationTimeout': 123
                }
            },
            'AutoScalingPolicy': {
                'Status': {
                    'State': 'PENDING'|'ATTACHING'|'ATTACHED'|'DETACHING'|'DETACHED'|'FAILED',
                    'StateChangeReason': {
                        'Code': 'USER_REQUEST'|'PROVISION_FAILURE'|'CLEANUP_FAILURE',
                        'Message': 'string'
                    }
                },
                'Constraints': {
                    'MinCapacity': 123,
                    'MaxCapacity': 123
                },
                'Rules': [
                    {
                        'Name': 'string',
                        'Description': 'string',
                        'Action': {
                            'Market': 'ON_DEMAND'|'SPOT',
                            'SimpleScalingPolicyConfiguration': {
                                'AdjustmentType': 'CHANGE_IN_CAPACITY'|'PERCENT_CHANGE_IN_CAPACITY'|'EXACT_CAPACITY',
                                'ScalingAdjustment': 123,
                                'CoolDown': 123
                            }
                        },
                        'Trigger': {
                            'CloudWatchAlarmDefinition': {
                                'ComparisonOperator': 'GREATER_THAN_OR_EQUAL'|'GREATER_THAN'|'LESS_THAN'|'LESS_THAN_OR_EQUAL',
                                'EvaluationPeriods': 123,
                                'MetricName': 'string',
                                'Namespace': 'string',
                                'Period': 123,
                                'Statistic': 'SAMPLE_COUNT'|'AVERAGE'|'SUM'|'MINIMUM'|'MAXIMUM',
                                'Threshold': 123.0,
                                'Unit': 'NONE'|'SECONDS'|'MICRO_SECONDS'|'MILLI_SECONDS'|'BYTES'|'KILO_BYTES'|'MEGA_BYTES'|'GIGA_BYTES'|'TERA_BYTES'|'BITS'|'KILO_BITS'|'MEGA_BITS'|'GIGA_BITS'|'TERA_BITS'|'PERCENT'|'COUNT'|'BYTES_PER_SECOND'|'KILO_BYTES_PER_SECOND'|'MEGA_BYTES_PER_SECOND'|'GIGA_BYTES_PER_SECOND'|'TERA_BYTES_PER_SECOND'|'BITS_PER_SECOND'|'KILO_BITS_PER_SECOND'|'MEGA_BITS_PER_SECOND'|'GIGA_BITS_PER_SECOND'|'TERA_BITS_PER_SECOND'|'COUNT_PER_SECOND',
                                'Dimensions': [
                                    {
                                        'Key': 'string',
                                        'Value': 'string'
                                    },
                                ]
                            }
                        }
                    },
                ]
            },
            'CustomAmiId': 'string'
        },
    ],
    'Marker': 'string'
}

Response Structure

  • (dict) –

    This input determines which instance groups to retrieve.

    • InstanceGroups (list) –

      The list of instance groups for the cluster and given filters.

      • (dict) –

        This entity represents an instance group, which is a group of instances that have common purpose. For example, CORE instance group is used for HDFS.

        • Id (string) –

          The identifier of the instance group.

        • Name (string) –

          The name of the instance group.

        • Market (string) –

          The marketplace to provision instances for this group. Valid values are ON_DEMAND or SPOT.

        • InstanceGroupType (string) –

          The type of the instance group. Valid values are MASTER, CORE or TASK.

        • BidPrice (string) –

          If specified, indicates that the instance group uses Spot Instances. This is the maximum price you are willing to pay for Spot Instances. Specify OnDemandPrice to set the amount equal to the On-Demand price, or specify an amount in USD.

        • InstanceType (string) –

          The Amazon EC2 instance type for all instances in the instance group.

        • RequestedInstanceCount (integer) –

          The target number of instances for the instance group.

        • RunningInstanceCount (integer) –

          The number of instances currently running in this instance group.

        • Status (dict) –

          The current status of the instance group.

          • State (string) –

            The current state of the instance group.

          • StateChangeReason (dict) –

            The status change reason details for the instance group.

            • Code (string) –

              The programmable code for the state change reason.

            • Message (string) –

              The status change reason description.

          • Timeline (dict) –

            The timeline of the instance group status over time.

            • CreationDateTime (datetime) –

              The creation date and time of the instance group.

            • ReadyDateTime (datetime) –

              The date and time when the instance group became ready to perform tasks.

            • EndDateTime (datetime) –

              The date and time when the instance group terminated.

        • Configurations (list) –

          Note

          Amazon EMR releases 4.x or later.

          The list of configurations supplied for an Amazon EMR cluster instance group. You can specify a separate configuration for each instance group (master, core, and task).

          • (dict) –

            Note

            Amazon EMR releases 4.x or later.

            An optional configuration specification to be used when provisioning cluster instances, which can include configurations for applications and software bundled with Amazon EMR. A configuration consists of a classification, properties, and optional nested configurations. A classification refers to an application-specific configuration file. Properties are the settings you want to change in that file. For more information, see Configuring Applications.

            • Classification (string) –

              The classification within a configuration.

            • Configurations (list) –

              A list of additional configurations to apply within a configuration object.

            • Properties (dict) –

              A set of properties specified within a configuration classification.

              • (string) –

                • (string) –

        • ConfigurationsVersion (integer) –

          The version number of the requested configuration specification for this instance group.

        • LastSuccessfullyAppliedConfigurations (list) –

          A list of configurations that were successfully applied for an instance group last time.

          • (dict) –

            Note

            Amazon EMR releases 4.x or later.

            An optional configuration specification to be used when provisioning cluster instances, which can include configurations for applications and software bundled with Amazon EMR. A configuration consists of a classification, properties, and optional nested configurations. A classification refers to an application-specific configuration file. Properties are the settings you want to change in that file. For more information, see Configuring Applications.

            • Classification (string) –

              The classification within a configuration.

            • Configurations (list) –

              A list of additional configurations to apply within a configuration object.

            • Properties (dict) –

              A set of properties specified within a configuration classification.

              • (string) –

                • (string) –

        • LastSuccessfullyAppliedConfigurationsVersion (integer) –

          The version number of a configuration specification that was successfully applied for an instance group last time.

        • EbsBlockDevices (list) –

          The EBS block devices that are mapped to this instance group.

          • (dict) –

            Configuration of requested EBS block device associated with the instance group.

            • VolumeSpecification (dict) –

              EBS volume specifications such as volume type, IOPS, size (GiB) and throughput (MiB/s) that are requested for the EBS volume attached to an Amazon EC2 instance in the cluster.

              • VolumeType (string) –

                The volume type. Volume types supported are gp3, gp2, io1, st1, sc1, and standard.

              • Iops (integer) –

                The number of I/O operations per second (IOPS) that the volume supports.

              • SizeInGB (integer) –

                The volume size, in gibibytes (GiB). This can be a number from 1 - 1024. If the volume type is EBS-optimized, the minimum value is 10.

              • Throughput (integer) –

                The throughput, in mebibyte per second (MiB/s). This optional parameter can be a number from 125 - 1000 and is valid only for gp3 volumes.

            • Device (string) –

              The device name that is exposed to the instance, such as /dev/sdh.

        • EbsOptimized (boolean) –

          If the instance group is EBS-optimized. An Amazon EBS-optimized instance uses an optimized configuration stack and provides additional, dedicated capacity for Amazon EBS I/O.

        • ShrinkPolicy (dict) –

          Policy for customizing shrink operations.

          • DecommissionTimeout (integer) –

            The desired timeout for decommissioning an instance. Overrides the default YARN decommissioning timeout.

          • InstanceResizePolicy (dict) –

            Custom policy for requesting termination protection or termination of specific instances when shrinking an instance group.

            • InstancesToTerminate (list) –

              Specific list of instances to be terminated when shrinking an instance group.

              • (string) –

            • InstancesToProtect (list) –

              Specific list of instances to be protected when shrinking an instance group.

              • (string) –

            • InstanceTerminationTimeout (integer) –

              Decommissioning timeout override for the specific list of instances to be terminated.

        • AutoScalingPolicy (dict) –

          An automatic scaling policy for a core instance group or task instance group in an Amazon EMR cluster. The automatic scaling policy defines how an instance group dynamically adds and terminates Amazon EC2 instances in response to the value of a CloudWatch metric. See PutAutoScalingPolicy.

          • Status (dict) –

            The status of an automatic scaling policy.

            • State (string) –

              Indicates the status of the automatic scaling policy.

            • StateChangeReason (dict) –

              The reason for a change in status.

              • Code (string) –

                The code indicating the reason for the change in status. USER_REQUEST indicates that the scaling policy status was changed by a user. PROVISION_FAILURE indicates that the status change was because the policy failed to provision. CLEANUP_FAILURE indicates an error.

              • Message (string) –

                A friendly, more verbose message that accompanies an automatic scaling policy state change.

          • Constraints (dict) –

            The upper and lower Amazon EC2 instance limits for an automatic scaling policy. Automatic scaling activity will not cause an instance group to grow above or below these limits.

            • MinCapacity (integer) –

              The lower boundary of Amazon EC2 instances in an instance group below which scaling activities are not allowed to shrink. Scale-in activities will not terminate instances below this boundary.

            • MaxCapacity (integer) –

              The upper boundary of Amazon EC2 instances in an instance group beyond which scaling activities are not allowed to grow. Scale-out activities will not add instances beyond this boundary.

          • Rules (list) –

            The scale-in and scale-out rules that comprise the automatic scaling policy.

            • (dict) –

              A scale-in or scale-out rule that defines scaling activity, including the CloudWatch metric alarm that triggers activity, how Amazon EC2 instances are added or removed, and the periodicity of adjustments. The automatic scaling policy for an instance group can comprise one or more automatic scaling rules.

              • Name (string) –

                The name used to identify an automatic scaling rule. Rule names must be unique within a scaling policy.

              • Description (string) –

                A friendly, more verbose description of the automatic scaling rule.

              • Action (dict) –

                The conditions that trigger an automatic scaling activity.

                • Market (string) –

                  Not available for instance groups. Instance groups use the market type specified for the group.

                • SimpleScalingPolicyConfiguration (dict) –

                  The type of adjustment the automatic scaling activity makes when triggered, and the periodicity of the adjustment.

                  • AdjustmentType (string) –

                    The way in which Amazon EC2 instances are added (if ScalingAdjustment is a positive number) or terminated (if ScalingAdjustment is a negative number) each time the scaling activity is triggered. CHANGE_IN_CAPACITY is the default. CHANGE_IN_CAPACITY indicates that the Amazon EC2 instance count increments or decrements by ScalingAdjustment, which should be expressed as an integer. PERCENT_CHANGE_IN_CAPACITY indicates the instance count increments or decrements by the percentage specified by ScalingAdjustment, which should be expressed as an integer. For example, 20 indicates an increase in 20% increments of cluster capacity. EXACT_CAPACITY indicates the scaling activity results in an instance group with the number of Amazon EC2 instances specified by ScalingAdjustment, which should be expressed as a positive integer.

                  • ScalingAdjustment (integer) –

                    The amount by which to scale in or scale out, based on the specified AdjustmentType. A positive value adds to the instance group’s Amazon EC2 instance count while a negative number removes instances. If AdjustmentType is set to EXACT_CAPACITY, the number should only be a positive integer. If AdjustmentType is set to PERCENT_CHANGE_IN_CAPACITY, the value should express the percentage as an integer. For example, -20 indicates a decrease in 20% increments of cluster capacity.

                  • CoolDown (integer) –

                    The amount of time, in seconds, after a scaling activity completes before any further trigger-related scaling activities can start. The default value is 0.

              • Trigger (dict) –

                The CloudWatch alarm definition that determines when automatic scaling activity is triggered.

                • CloudWatchAlarmDefinition (dict) –

                  The definition of a CloudWatch metric alarm. When the defined alarm conditions are met along with other trigger parameters, scaling activity begins.

                  • ComparisonOperator (string) –

                    Determines how the metric specified by MetricName is compared to the value specified by Threshold.

                  • EvaluationPeriods (integer) –

                    The number of periods, in five-minute increments, during which the alarm condition must exist before the alarm triggers automatic scaling activity. The default value is 1.

                  • MetricName (string) –

                    The name of the CloudWatch metric that is watched to determine an alarm condition.

                  • Namespace (string) –

                    The namespace for the CloudWatch metric. The default is AWS/ElasticMapReduce.

                  • Period (integer) –

                    The period, in seconds, over which the statistic is applied. CloudWatch metrics for Amazon EMR are emitted every five minutes (300 seconds), so if you specify a CloudWatch metric, specify 300.

                  • Statistic (string) –

                    The statistic to apply to the metric associated with the alarm. The default is AVERAGE.

                  • Threshold (float) –

                    The value against which the specified statistic is compared.

                  • Unit (string) –

                    The unit of measure associated with the CloudWatch metric being watched. The value specified for Unit must correspond to the units specified in the CloudWatch metric.

                  • Dimensions (list) –

                    A CloudWatch metric dimension.

                    • (dict) –

                      A CloudWatch dimension, which is specified using a Key (known as a Name in CloudWatch), Value pair. By default, Amazon EMR uses one dimension whose Key is JobFlowID and Value is a variable representing the cluster ID, which is ${emr.clusterId}. This enables the rule to bootstrap when the cluster ID becomes available.

                      • Key (string) –

                        The dimension name.

                      • Value (string) –

                        The dimension value.

        • CustomAmiId (string) –

          The custom AMI ID to use for the provisioned instance group.

    • Marker (string) –

      The pagination token that indicates the next set of results to retrieve.

Exceptions

  • EMR.Client.exceptions.InternalServerException

  • EMR.Client.exceptions.InvalidRequestException