Skip to main content

aws_lambda_aliases Resource

Use the aws_lambda_aliases InSpec audit resource to test properties of multiple AWS Lambda aliases.

The AWS::Lambda::Alias resource creates an alias for a Lambda function version. Use aliases to provide clients with a function identifier that you can update to invoke a different version.

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

Install

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.

Syntax

Ensure that the alias exists.

describe aws_lambda_aliases(function_name: 'FUNCTION_NAME') do
  it { should exist }
end

Parameters

function_name (required)

The name of the lambda function.

Properties

alias_arns
Lambda function ARN that is qualified using the alias name as the suffix.

Field: alias_arn

names
The alias names.

Field: name

function_versions
Function version to which the alias points.

Field: function_version

descriptions
The alias descriptions.

Field: description

routing_configs
Specifies an additional function versions the alias points to, allowing you to dictate what percentage of traffic will invoke each version.

Field: routing_config

revision_ids
Represents the latest updated revision of the function or alias.

Field: revision_id

Examples

Ensure an alias ARN is available.

describe aws_lambda_aliases(function_name: 'FUNCTION_NAME') do
  its('alias_arns') { should include 'ALIAS_ARN' }
end

Ensure an alias name is available.

describe aws_lambda_aliases(function_name: 'FUNCTION_NAME') do
  its('names') { should include 'FUNCTION_ALIAS_NAME' }
end

Matchers

For a full list of available matchers, see our Universal Matchers page.

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

exist

Use should to test that the entity exists.

describe aws_lambda_aliases(function_name: 'FUNCTION_NAME') do
  it { should exist }
end

Use should_not to test the entity does not exist.

describe aws_lambda_aliases(function_name: 'FUNCTION_NAME') do
  it { should_not exist }
end

be_available

Use should to check if the entity is available.

describe aws_lambda_aliases(function_name: 'FUNCTION_NAME') do
  it { should be_available }
end

AWS Permissions

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

Edit this page on GitHub

Thank you for your feedback!

×









Search Results