CodeSigningConfig for AWS Lambda

Hello,
Is there a way to add CodeSigningConfigArn in the serverless.yml file? As per AWS Cloudformation documentation, CodeSigningConfigArn is used to enable code signing for the function.

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html

How do I use that with Serverless?

Hi Shasha,

I’m leaving this here for anyone that comes across this:

With your serverless file you will have a function block such as:

functions:
  ApiAuthorizer:
    name: api-authorizer-name
    handler: com.company.project.authorizer.AuthorizerFunction
    package:
      artifact: ${param:myS3Location}/authorizer.zip
    timeout: 300

Then at the top level (so the level where “functions” is defined in the serverless.yml file you have this resource and extensions configuration:

resources:
  extensions:
    ApiAuthorizerLambdaFunction:
      Properties:
        CodeSigningConfigArn:
          ${ssm:/myProject/signingConfig}

Two things here:

  1. The name of the extension is the lambda function identifier NOT the name under the lambda function. In this case “ApiAuthorizer” not “api-authorizer-name”
  2. You’ll also need a signing configuration set up that you can use. In my case it comes from ssm.