title | platform |
---|---|
About the aws_lambda_version Resource |
aws |
Use the aws_lambda_version
InSpec audit resource to test properties of a single AWS Lambda function version.
The AWS::Lambda::Version
resource creates a version from the current code and configuration of a function. Use versions to create a snapshot of your function code and configuration that doesn't change.
Ensure that the Lambda layer version exists.
describe aws_lambda_version(layer_name: 'LAYER_NAME', version_number: 1) do
it { should exist }
end
layer_name
(required)
The name or Amazon Resource Name (ARN) of the Lambda layer.
version_number
(required)
The version number.
For additional information, see the AWS documentation on AWS Lambda Version.
Property | Description |
---|---|
content.location | A link to the layer archive in Amazon S3 that is valid for 10 minutes. |
content.code_sha_256 | The SHA-256 hash of the layer archive. |
content.code_size | The size of the layer archive in bytes. |
content.signing_profile_version_arn | The Amazon Resource Name (ARN) for a signing profile version. |
content.signing_job_arn | The Amazon Resource Name (ARN) of a signing job. |
layer_arn | The ARN of the layer. |
layer_version_arn | The ARN of the layer version. |
description | The description of the version. |
created_date | The date that the layer version was created, in ISO-8601 format (YYYY-MM-DDThh:mm:ss.sTZD). |
version | The version number. |
compatible_runtimes | The layer's compatible runtimes. |
license_info | The layer's software license. |
compatible_architectures | A list of compatible instruction set architectures. |
describe aws_lambda_version(layer_name: 'LAYER_NAME', version_number: 1) do
its('layer_arn') { should eq 'LAYER_ARN' }
end
describe aws_lambda_version(layer_name: 'LAYER_NAME', version_number: 1) do
its('layer_version_arn') { should eq 'LAYER_VERSION_ARN' }
end
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.
Use should
to test that the entity exists.
describe aws_lambda_version(layer_name: 'LAYER_NAME', version_number: 1) do
it { should exist }
end
Use should_not
to test the entity does not exist.
describe aws_lambda_version(layer_name: 'LAYER_NAME', version_number: 1) do
it { should_not exist }
end
Use should
to check if the entity is available.
describe aws_lambda_version(layer_name: 'LAYER_NAME', version_number: 1) do
it { should be_available }
end
Your Principal will need the Lambda:Client:GetLayerVersionResponse
action with Effect
set to Allow
.