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.
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_arnnames- The alias names.
Field:
namefunction_versions- Function version to which the alias points.
Field:
function_versiondescriptions- The alias descriptions.
Field:
descriptionrouting_configs- Specifies an additional function versions the alias points to, allowing you to dictate what percentage of traffic will invoke each version.
Field:
routing_configrevision_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 AWS principal will need the Lambda:Client:ListAliasesResponse action with Effect set to Allow.