Skip to main content

aws_ec2_launch_templates Resource

Use the aws_ec2_launch_templates InSpec audit resource to test properties of a all the AWS Launch templates.


This resource is available in the Chef InSpec AWS resource pack.

For information on configuring your AWS environment for Chef InSpec and creating an InSpec profile that uses the InSpec AWS resource pack, see the Chef InSpec documentation on the AWS cloud platform.


An aws_ec2_launch_templates resource block declares the tests for a all the AWS Launch templates.

describe aws_ec2_launch_templates do it { should exist } end



The ID of the EC2 launch_templates. This is in the format of lt- followed by 8 or 17 hexadecimal characters. This can be passed either as a string or as an launch_templates_id: 'value' key-value entry in a hash.


The name of launch template.
The id of the launch template.
The create time of the launch template.
The name by whom the launch template is created.
The default_version_number of the launch template.
The latest_version_number of the launch template.
A list of hashes with each key-value pair corresponding to an EC2 Launch template tag, e.g, [{:key=>"Name", :value=>"Testing Box"}, {:key=>"Environment", :value=>"Dev"}].

There are also additional properties available. For a comprehensive list, see the API reference documentation


Test that an launch templates should exist.

describe aws_ec2_launch_templates do it { should exist } end

Test that an EC2 instance is using the correct AMI.

describe aws_ec2_launch_templates do its(’launch_template_ids.count’) { should cmp 3 } end

Test that an EC2 instance has the correct tag.

describe aws_ec2_launch_templates do its(’launch_templates_names’) { should include ’test-lt’ } end


For a full list of available matchers, see our Universal Matchers page.
Edit this page on GitHub

Thank you for your feedback!


Search Results