Use DescribeLaunchConfigurations with a CLI
The following code examples show how to use DescribeLaunchConfigurations.
- CLI
-
- Amazon CLI
-
Example 1: To describe the specified launch configuration
The following
describe-launch-configurationsexample describes the specified launch configuration.aws autoscaling describe-launch-configurations \ --launch-configuration-namesmy-launch-configOutput:
{ "LaunchConfigurations": [ { "LaunchConfigurationName": "my-launch-config", "LaunchConfigurationARN": "arn:aws:autoscaling:us-west-2:123456789012:launchConfiguration:a1b2c3d4-5678-90ab-cdef-EXAMPLE11111: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
The following
describe-launch-configurationsexample uses the--max-itemsoption to return a specific number of launch configurations.aws autoscaling describe-launch-configurations \ --max-items1Output:
{ "LaunchConfigurations": [ { "LaunchConfigurationName": "my-launch-config", "LaunchConfigurationARN": "arn:aws:autoscaling:us-west-2:123456789012:launchConfiguration:a1b2c3d4-5678-90ab-cdef-EXAMPLE11111: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" } } ], "NextToken": "Z3M3LMPEXAMPLE" }If the output includes a
NextTokenfield, there are more launch configurations. To get the additional launch configurations, use the value of this field with the--starting-tokenoption in a subsequent call as follows.aws autoscaling describe-launch-configurations \ --starting-tokenZ3M3LMPEXAMPLEFor more information, see Auto Scaling launch configurations
in the Amazon EC2 Auto Scaling User Guide. -
For API details, see DescribeLaunchConfigurations
in Amazon CLI Command Reference.
-
- PowerShell
-
- Tools for PowerShell V4
-
Example 1: This example lists the names of your launch configurations.
Get-ASLaunchConfiguration | format-table -property LaunchConfigurationNameOutput:
LaunchConfigurationName ----------------------- my-lc-1 my-lc-2 my-lc-3 my-lc-4 my-lc-5Example 2: This example describes the specified launch configuration.
Get-ASLaunchConfiguration -LaunchConfigurationName my-lc-1Output:
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-
For API details, see DescribeLaunchConfigurations
in Amazon Tools for PowerShell Cmdlet Reference (V4).
-
- Tools for PowerShell V5
-
Example 1: This example lists the names of your launch configurations.
Get-ASLaunchConfiguration | format-table -property LaunchConfigurationNameOutput:
LaunchConfigurationName ----------------------- my-lc-1 my-lc-2 my-lc-3 my-lc-4 my-lc-5Example 2: This example describes the specified launch configuration.
Get-ASLaunchConfiguration -LaunchConfigurationName my-lc-1Output:
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-
For API details, see DescribeLaunchConfigurations
in Amazon Tools for PowerShell Cmdlet Reference (V5).
-
For a complete list of Amazon SDK developer guides and code examples, see Using this service with an Amazon SDK. This topic also includes information about getting started and details about previous SDK versions.