Use DescribeLaunchConfigurations with a CLI - AWS SDK Code Examples

There are more AWS SDK examples available in the AWS Doc SDK Examples GitHub repo.

Use DescribeLaunchConfigurations with a CLI

The following code examples show how to use DescribeLaunchConfigurations.

CLI
AWS CLI

Example 1: To describe the specified launch configuration

This example describes the specified launch configuration.

aws autoscaling describe-launch-configurations \ --launch-configuration-names my-launch-config

Output:

{ "LaunchConfigurations": [ { "LaunchConfigurationName": "my-launch-config", "LaunchConfigurationARN": "arn:aws:autoscaling:us-west-2:123456789012:launchConfiguration:98d3b196-4cf9-4e88-8ca1-8547c24ced8b:launchConfigurationName/my-launch-config", "ImageId": "ami-0528a5175983e7f28", "KeyName": "my-key-pair-uswest2", "SecurityGroups": [ "sg-05eaec502fcdadc2e" ], "ClassicLinkVPCSecurityGroups": [], "UserData": "", "InstanceType": "t2.micro", "KernelId": "", "RamdiskId": "", "BlockDeviceMappings": [ { "DeviceName": "/dev/xvda", "Ebs": { "SnapshotId": "snap-06c1606ba5ca274b1", "VolumeSize": 8, "VolumeType": "gp2", "DeleteOnTermination": true, "Encrypted": false } } ], "InstanceMonitoring": { "Enabled": true }, "CreatedTime": "2020-10-28T02:39:22.321Z", "EbsOptimized": false, "AssociatePublicIpAddress": true, "MetadataOptions": { "HttpTokens": "required", "HttpPutResponseHopLimit": 1, "HttpEndpoint": "disabled" } } ] }

Example 2: To describe a specified number of launch configurations

To return a specific number of launch configurations, use the --max-items option.

aws autoscaling describe-launch-configurations \ --max-items 1

If the output includes a NextToken field, there are more launch configurations. To get the additional launch configurations, use the value of this field with the --starting-token option in a subsequent call as follows.

aws autoscaling describe-launch-configurations \ --starting-token Z3M3LMPEXAMPLE
PowerShell
Tools for PowerShell

Example 1: This example lists the names of your launch configurations.

Get-ASLaunchConfiguration | format-table -property LaunchConfigurationName

Output:

LaunchConfigurationName ----------------------- my-lc-1 my-lc-2 my-lc-3 my-lc-4 my-lc-5

Example 2: This example describes the specified launch configuration.

Get-ASLaunchConfiguration -LaunchConfigurationName my-lc-1

Output:

AssociatePublicIpAddress : True BlockDeviceMappings : {/dev/xvda} ClassicLinkVPCId : ClassicLinkVPCSecurityGroups : {} CreatedTime : 12/12/2014 3:22:08 PM EbsOptimized : False IamInstanceProfile : ImageId : ami-043a5034 InstanceMonitoring : Amazon.AutoScaling.Model.InstanceMonitoring InstanceType : t2.micro KernelId : KeyName : LaunchConfigurationARN : arn:aws:autoscaling:us-west-2:123456789012:launchConfiguration:7e5f31e4-693b-4604-9322- e6f68d7fafad:launchConfigurationName/my-lc-1 LaunchConfigurationName : my-lc-1 PlacementTenancy : RamdiskId : SecurityGroups : {sg-67ef0308} SpotPrice : UserData :

Example 3: This example describes the specified two launch configurations.

Get-ASLaunchConfiguration -LaunchConfigurationName @("my-lc-1", "my-lc-2")

Example 4: This example describes all your launch configurations.

Get-ASLaunchConfiguration