Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
sfussenegger opened this issue Feb 5, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@sfussenegger
Copy link

Name of the resource

AWS::Lambda::Function

Resource name

No response

Description

Add CodeSha256 output from Lambda function config for use with Fn::GetAtt as input for AWS::Lambda::Version

Updated CloudFormation AWS::Lambda::Version Example:

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

@sfussenegger sfussenegger added the enhancement New feature or request label Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant