aws-cloudformation / aws-cloudformation/cloudformation-coverage-roadmap

[AWS::Lambda::Function] - [Enhancement] - Add CodeSha256 output for use as AWS::Lambda::Version property

Open
#2,254 0 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
No language data
Stars
1.1k
Forks
62
PR merge metrics
No merged PRs in 30d

Description

### Name of the resource

AWS::Lambda::Function

### Resource name

_No response_

### Description

Add `CodeSha256` output from [Lambda function config](https://docs.aws.amazon.com/lambda/latest/api/API_FunctionConfiguration.html#lambda-Type-FunctionConfiguration-CodeSha256) for use with `Fn::GetAtt` as input for AWS::Lambda::Version

Updated [CloudFormation AWS::Lambda::Version Example](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-version.html#aws-resource-lambda-version--examples):

```yaml
Resources:
function:
Type: AWS::Lambda::Function
Properties:
Handler: index.handler
Role: arn:aws:iam::123456789012:role/lambda-role
Code:
ZipFile: |
exports.handler = async (event) => {
console.log(JSON.stringify(event, null, 2));
const response = {
statusCode: 200,
body: JSON.stringify('Hello from Lambda!'),
};
return response;
};
Runtime: nodejs18.x
TracingConfig:
Mode: Active
version:
Type: AWS::Lambda::Version
Properties:
FunctionName: !Ref function
Description: v1
CodeSha256: !GetAtt function.CodeSha256 # use new function.CodeSha256
ProvisionedConcurrencyConfig:
ProvisionedConcurrentExecutions: 20
```
Note: it might be useful to use `UpdateReplacePolicy: Retain` for some `AWS::Lambda::Version` use cases

### Other Details

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the AWS::Lambda::Function resource and the linked Lambda FunctionConfiguration API documentation to confirm the CodeSha256 attribute. Done means CodeSha256 is exposed for Fn::GetAtt and the AWS::Lambda::Version example uses it as shown.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws
Domain
cloud, infrastructure
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.