Skip to main content

aws_lambdas resource

Use the aws_lambdas resource to test the collection of lambdas deployed into an account.

Syntax

describe aws_lambdas do
    its('count') { should eq 20 }
end

Parameters

This resource does not require any parameters.

Properties

names
The names of the lambda deployed.
tags
The tags of the lambda deployed.

Examples

Tests that all lambdas with a particular tag is correctly deployed:

lambdas = aws_lambdas()

describe lambdas do
its ('count') { should eq 33}
end

lambdas.tags.each_with_index { | tag, i |
if tag!= {} and tag.include? 'Application' and tag['Application']=='test')
    lambda_name = lambdas.names[i]

    describe aws_lambda(lambda_name) do
        it { should exist}
        its ('handler') { should eq 'main.on_event'}
        its ('version') { should eq '$LATEST' }
        its ('runtime') { should eq 'python3.7' }
    end
end
}

Matchers

This InSpec audit resource uses the standard matchers. For a full list of available matchers, visit the InSpec matchers page.

AWS Permissions

Your AWS principal will need the Lambda:Client:ListFunctionsResponse action with Effect set to Allow.

You can find detailed documentation at AWS Lambda

Thank you for your feedback!

×