Bootstrap FreeKB - Amazon Web Services (AWS) - List Launch Templates using the AWS CLI
Amazon Web Services (AWS) - List Launch Templates using the AWS CLI

Updated:   |  Amazon Web Services (AWS) articles

This assumes you have already configured the aws command line tool. If not, check out my article on Getting Started with the AWS CLI.

An EC2 Launch Template is a way to set certain defaults for launching a new EC2 instance, such as the SSH Key Pairs, Network Subnets, Security Groups, Amazon Machine Image, et cetera that the EC2 Instance will have. An EC2 Launch Template is often used with an EC2 Auto Scaling Group, to auto scale a collection of EC2 instances based on needs, such as when load is high or low is low.

The aws ec2 describe-launch-templates command can be used to list your Launch Templates.

aws ec2 describe-launch-templates

 

And here is an example of how to limit the output using the --query option.

aws ec2 describe-launch-templates --query 'LaunchTemplates[?LaunchTemplateName==`my-launch-template`]'

 

Something like this should be returned.

{
    "LaunchTemplates": [
        {
            "LatestVersionNumber": 1,
            "LaunchTemplateId": "lt-0dfee84b8657928cb",
            "LaunchTemplateName": "my-launch-template",
            "DefaultVersionNumber": 1,
            "CreatedBy": "arn:aws:iam::123456789012:user/johndoe",
            "CreateTime": "2024-02-06T02:43:24.000Z"
        }
    ]
}

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter a24203 in the box below so that we can be sure you are a human.