Skip to main content

aws_lambda_permission Resource

Use the aws_lambda_permission InSpec audit resource to test properties of a single AWS Lambda permission.

The AWS::Lambda::Permission resource grants an AWS service or another account permission to use a function. You can apply the policy at the function level, or specify a qualifier to restrict access to a single version or alias. If you use a qualifier, the invoker must use the full Amazon Resource Name (ARN) of that version or alias to invoke the function.

For additional information, including details on parameters and properties, see the AWS documentation on AWS Lambda permission.

Installation

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

See the Chef InSpec documentation on cloud platforms for information on configuring your AWS environment for InSpec and creating an InSpec profile that uses the InSpec AWS resource pack.

Syntax

Ensure that permission has the desired statement ID.

describe aws_lambda_permission(function_name: 'LAMBDA_FUNCTION_NAME', Sid: 'STATEMENT_ID') do
  its('sid') { should eq 'STATEMENT_ID' }
end

Parameters

function_name (required)

The name of the Lambda function.

Sid (required)

The statement ID of the function.

Properties

sid
The statement ID of the function.
effect
The effect of the function.
principal
The AWS service or account that invokes the function.
action
The action that the principal can use on the function.
resource
The resource ARN of the function.

Examples

Ensure a statement ID is available.

describe aws_lambda_permission(function_name: 'LAMBDA_FUNCTION_NAME', Sid: 'STATEMENT_ID') do
  its('sid') { should eq 'StatementID' }
end

Ensure a effect is available.

describe aws_lambda_permission(function_name: 'LAMBDA_FUNCTION_NAME', Sid: 'STATEMENT_ID') do
    its('effect') { should eq 'Allow' }
end

Matchers

This InSpec audit resource has the following special matchers. For a full list of available matchers, please visit our Universal Matchers page.

The controls will pass if the get method returns at least one result.

AWS Permissions

Your Principal will need the Lambda:Client:GetPolicyResponse action with Effect set to Allow.

Edit this page on GitHub

Thank you for your feedback!

×









Search Results