Apply AWS Lambda Event configuration to specific Lambda version?

I would like to give myself the ability to rollback the Lambda that my SQS events trigger if I ship bad code. To do this, I would like to “pin” a specific version of a lambda in my serverless.yml that my SQS event configuration should apply to, as the default is seemingly just $LATEST

Is this possible? Basically I’d like to be able to do something like

myLambda:
    handler: src/handler.myLambda
    events:
      - sqs:
        arn: arn:my:sqs:queue
        targetVersion: 12 <-- Specific Lambda Version that the event configuration applies to
        batchSize: 100
        maximumBatchingWindow: 30

I don’t see something like this mentioned anywhere in the Serverless event docs, but this is so critical it has to exist - right?

1 Like