AutoScaling / Client / describe_launch_configurations

describe_launch_configurations#

AutoScaling.Client.describe_launch_configurations(**kwargs)#

Gets information about the launch configurations in the account and Region.

See also: AWS API Documentation

Request Syntax

response = client.describe_launch_configurations(
    LaunchConfigurationNames=[
        'string',
    ],
    NextToken='string',
    MaxRecords=123
)
Parameters:
  • LaunchConfigurationNames (list) –

    The launch configuration names. If you omit this property, all launch configurations are described.

    Array Members: Maximum number of 50 items.

    • (string) –

  • NextToken (string) – The token for the next set of items to return. (You received this token from a previous call.)

  • MaxRecords (integer) – The maximum number of items to return with this call. The default value is 50 and the maximum value is 100.

Return type:

dict

Returns:

Response Syntax

{
    'LaunchConfigurations': [
        {
            'LaunchConfigurationName': 'string',
            'LaunchConfigurationARN': 'string',
            'ImageId': 'string',
            'KeyName': 'string',
            'SecurityGroups': [
                'string',
            ],
            'ClassicLinkVPCId': 'string',
            'ClassicLinkVPCSecurityGroups': [
                'string',
            ],
            'UserData': 'string',
            'InstanceType': 'string',
            'KernelId': 'string',
            'RamdiskId': 'string',
            'BlockDeviceMappings': [
                {
                    'VirtualName': 'string',
                    'DeviceName': 'string',
                    'Ebs': {
                        'SnapshotId': 'string',
                        'VolumeSize': 123,
                        'VolumeType': 'string',
                        'DeleteOnTermination': True|False,
                        'Iops': 123,
                        'Encrypted': True|False,
                        'Throughput': 123
                    },
                    'NoDevice': True|False
                },
            ],
            'InstanceMonitoring': {
                'Enabled': True|False
            },
            'SpotPrice': 'string',
            'IamInstanceProfile': 'string',
            'CreatedTime': datetime(2015, 1, 1),
            'EbsOptimized': True|False,
            'AssociatePublicIpAddress': True|False,
            'PlacementTenancy': 'string',
            'MetadataOptions': {
                'HttpTokens': 'optional'|'required',
                'HttpPutResponseHopLimit': 123,
                'HttpEndpoint': 'disabled'|'enabled'
            }
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) –

    • LaunchConfigurations (list) –

      The launch configurations.

      • (dict) –

        Describes a launch configuration.

        • LaunchConfigurationName (string) –

          The name of the launch configuration.

        • LaunchConfigurationARN (string) –

          The Amazon Resource Name (ARN) of the launch configuration.

        • ImageId (string) –

          The ID of the Amazon Machine Image (AMI) to use to launch your EC2 instances. For more information, see Find a Linux AMI in the Amazon EC2 User Guide for Linux Instances.

        • KeyName (string) –

          The name of the key pair.

          For more information, see Amazon EC2 key pairs and Amazon EC2 instances in the Amazon EC2 User Guide for Linux Instances.

        • SecurityGroups (list) –

          A list that contains the security groups to assign to the instances in the Auto Scaling group. For more information, see Control traffic to your Amazon Web Services resources using security groups in the Amazon Virtual Private Cloud User Guide.

          • (string) –

        • ClassicLinkVPCId (string) –

          Available for backward compatibility.

        • ClassicLinkVPCSecurityGroups (list) –

          Available for backward compatibility.

          • (string) –

        • UserData (string) –

          The user data to make available to the launched EC2 instances. For more information, see Instance metadata and user data (Linux) and Instance metadata and user data (Windows). If you are using a command line tool, base64-encoding is performed for you, and you can load the text from a file. Otherwise, you must provide base64-encoded text. User data is limited to 16 KB.

        • InstanceType (string) –

          The instance type for the instances. For information about available instance types, see Available instance types in the Amazon EC2 User Guide for Linux Instances.

        • KernelId (string) –

          The ID of the kernel associated with the AMI.

        • RamdiskId (string) –

          The ID of the RAM disk associated with the AMI.

        • BlockDeviceMappings (list) –

          The block device mapping entries that define the block devices to attach to the instances at launch. By default, the block devices specified in the block device mapping for the AMI are used. For more information, see Block device mappings in the Amazon EC2 User Guide for Linux Instances.

          • (dict) –

            Describes a block device mapping.

            • VirtualName (string) –

              The name of the instance store volume (virtual device) to attach to an instance at launch. The name must be in the form ephemeral*X* where X is a number starting from zero (0), for example, ephemeral0.

            • DeviceName (string) –

              The device name assigned to the volume (for example, /dev/sdh or xvdh). For more information, see Device naming on Linux instances in the Amazon EC2 User Guide for Linux Instances.

              Note

              To define a block device mapping, set the device name and exactly one of the following properties: Ebs, NoDevice, or VirtualName.

            • Ebs (dict) –

              Information to attach an EBS volume to an instance at launch.

              • SnapshotId (string) –

                The snapshot ID of the volume to use.

                You must specify either a VolumeSize or a SnapshotId.

              • VolumeSize (integer) –

                The volume size, in GiBs. The following are the supported volumes sizes for each volume type:

                • gp2 and gp3: 1-16,384

                • io1: 4-16,384

                • st1 and sc1: 125-16,384

                • standard: 1-1,024

                You must specify either a SnapshotId or a VolumeSize. If you specify both SnapshotId and VolumeSize, the volume size must be equal or greater than the size of the snapshot.

              • VolumeType (string) –

                The volume type. For more information, see Amazon EBS volume types in the Amazon EBS User Guide.

                Valid values: standard | io1 | gp2 | st1 | sc1 | gp3

              • DeleteOnTermination (boolean) –

                Indicates whether the volume is deleted on instance termination. For Amazon EC2 Auto Scaling, the default value is true.

              • Iops (integer) –

                The number of input/output (I/O) operations per second (IOPS) to provision for the volume. For gp3 and io1 volumes, this represents the number of IOPS that are provisioned for the volume. For gp2 volumes, this represents the baseline performance of the volume and the rate at which the volume accumulates I/O credits for bursting.

                The following are the supported values for each volume type:

                • gp3: 3,000-16,000 IOPS

                • io1: 100-64,000 IOPS

                For io1 volumes, we guarantee 64,000 IOPS only for Instances built on the Amazon Web Services Nitro System. Other instance families guarantee performance up to 32,000 IOPS.

                Iops is supported when the volume type is gp3 or io1 and required only when the volume type is io1. (Not used with standard, gp2, st1, or sc1 volumes.)

              • Encrypted (boolean) –

                Specifies whether the volume should be encrypted. Encrypted EBS volumes can only be attached to instances that support Amazon EBS encryption. For more information, see Requirements for Amazon EBS encryption in the Amazon EBS User Guide. If your AMI uses encrypted volumes, you can also only launch it on supported instance types.

                Note

                If you are creating a volume from a snapshot, you cannot create an unencrypted volume from an encrypted snapshot. Also, you cannot specify a KMS key ID when using a launch configuration.

                If you enable encryption by default, the EBS volumes that you create are always encrypted, either using the Amazon Web Services managed KMS key or a customer-managed KMS key, regardless of whether the snapshot was encrypted.

                For more information, see Use Amazon Web Services KMS keys to encrypt Amazon EBS volumes in the Amazon EC2 Auto Scaling User Guide.

              • Throughput (integer) –

                The throughput (MiBps) to provision for a gp3 volume.

            • NoDevice (boolean) –

              Setting this value to true prevents a volume that is included in the block device mapping of the AMI from being mapped to the specified device name at launch.

              If NoDevice is true for the root device, instances might fail the EC2 health check. In that case, Amazon EC2 Auto Scaling launches replacement instances.

        • InstanceMonitoring (dict) –

          Controls whether instances in this group are launched with detailed ( true) or basic ( false) monitoring.

          For more information, see Configure monitoring for Auto Scaling instances in the Amazon EC2 Auto Scaling User Guide.

          • Enabled (boolean) –

            If true, detailed monitoring is enabled. Otherwise, basic monitoring is enabled.

        • SpotPrice (string) –

          The maximum hourly price to be paid for any Spot Instance launched to fulfill the request. Spot Instances are launched when the price you specify exceeds the current Spot price. For more information, see Requesting Spot Instances for fault-tolerant and flexible applications in the Amazon EC2 Auto Scaling User Guide.

        • IamInstanceProfile (string) –

          The name or the Amazon Resource Name (ARN) of the instance profile associated with the IAM role for the instance. The instance profile contains the IAM role. For more information, see IAM role for applications that run on Amazon EC2 instances in the Amazon EC2 Auto Scaling User Guide.

        • CreatedTime (datetime) –

          The creation date and time for the launch configuration.

        • EbsOptimized (boolean) –

          Specifies whether the launch configuration is optimized for EBS I/O ( true) or not ( false). For more information, see Amazon EBS-optimized instances in the Amazon EC2 User Guide for Linux Instances.

        • AssociatePublicIpAddress (boolean) –

          Specifies whether to assign a public IPv4 address to the group’s instances. If the instance is launched into a default subnet, the default is to assign a public IPv4 address, unless you disabled the option to assign a public IPv4 address on the subnet. If the instance is launched into a nondefault subnet, the default is not to assign a public IPv4 address, unless you enabled the option to assign a public IPv4 address on the subnet. For more information, see Provide network connectivity for your Auto Scaling instances using Amazon VPC in the Amazon EC2 Auto Scaling User Guide.

        • PlacementTenancy (string) –

          The tenancy of the instance, either default or dedicated. An instance with dedicated tenancy runs on isolated, single-tenant hardware and can only be launched into a VPC.

        • MetadataOptions (dict) –

          The metadata options for the instances. For more information, see Configure the instance metadata options in the Amazon EC2 Auto Scaling User Guide.

          • HttpTokens (string) –

            The state of token usage for your instance metadata requests. If the parameter is not specified in the request, the default state is optional.

            If the state is optional, you can choose to retrieve instance metadata with or without a signed token header on your request. If you retrieve the IAM role credentials without a token, the version 1.0 role credentials are returned. If you retrieve the IAM role credentials using a valid signed token, the version 2.0 role credentials are returned.

            If the state is required, you must send a signed token header with any instance metadata retrieval requests. In this state, retrieving the IAM role credentials always returns the version 2.0 credentials; the version 1.0 credentials are not available.

          • HttpPutResponseHopLimit (integer) –

            The desired HTTP PUT response hop limit for instance metadata requests. The larger the number, the further instance metadata requests can travel.

            Default: 1

          • HttpEndpoint (string) –

            This parameter enables or disables the HTTP metadata endpoint on your instances. If the parameter is not specified, the default state is enabled.

            Note

            If you specify a value of disabled, you will not be able to access your instance metadata.

    • NextToken (string) –

      A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the NextToken value when requesting the next set of items. This value is null when there are no more items to return.

Exceptions

Examples

This example describes the specified launch configuration.

response = client.describe_launch_configurations(
    LaunchConfigurationNames=[
        'my-launch-config',
    ],
)

print(response)

Expected Output:

{
    'LaunchConfigurations': [
        {
            'AssociatePublicIpAddress': True,
            'BlockDeviceMappings': [
            ],
            'CreatedTime': datetime(2014, 5, 7, 17, 39, 28, 2, 127, 0),
            'EbsOptimized': False,
            'ImageId': 'ami-043a5034',
            'InstanceMonitoring': {
                'Enabled': True,
            },
            'InstanceType': 't1.micro',
            'LaunchConfigurationARN': 'arn:aws:autoscaling:us-west-2:123456789012:launchConfiguration:98d3b196-4cf9-4e88-8ca1-8547c24ced8b:launchConfigurationName/my-launch-config',
            'LaunchConfigurationName': 'my-launch-config',
            'SecurityGroups': [
                'sg-67ef0308',
            ],
        },
    ],
    'ResponseMetadata': {
        '...': '...',
    },
}