# Pruning AWS lambda functions to 5 versions

**URL:** <https://forum.serverless.com/t/pruning-aws-lambda-functions-to-5-versions/3893>\
**Category:** Serverless Framework\
**Tags:** aws, lambda\
**Created:** [February 28, 2018, 1:44am UTC](https://forum.serverless.com/t/pruning-aws-lambda-functions-to-5-versions/3893 "2018-02-28T01:44:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonsmirl](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/jonsmirl/32/776_2.png) [@jonsmirl](https://forum.serverless.com/u/jonsmirl)\
**Post date:** [February 28, 2018, 1:44am UTC](https://forum.serverless.com/t/pruning-aws-lambda-functions-to-5-versions/3893/1 "2018-02-28T01:44:00Z")

</div>

All of my lambda functions only have five versions. Who is pruning the older versions? It serverless doing it?

Can I control the number of versions I keep around?

---

<div class="post-metadata">

**Author:** ![DavidWells](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/davidwells/32/201_2.png) [@DavidWells](https://forum.serverless.com/u/DavidWells)\
**Post date:** [February 28, 2018, 1:51am UTC](https://forum.serverless.com/t/pruning-aws-lambda-functions-to-5-versions/3893/2 "2018-02-28T01:51:31Z")

</div>

I think it’s related to `versionFunctions` option on the `provider`

> <https://github.com/serverless/serverless/blob/2a3d57e3907ecce537bcf8d1b73074ed6a38a1b4/docs/providers/aws/guide/functions.md#versioning-deployed-functions>

Off the top of my head, I’m not sure if you can change.

---

<div class="post-metadata">

**Author:** ![jonsmirl](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/jonsmirl/32/776_2.png) [@jonsmirl](https://forum.serverless.com/u/jonsmirl)\
**Post date:** [February 28, 2018, 1:59am UTC](https://forum.serverless.com/t/pruning-aws-lambda-functions-to-5-versions/3893/3 "2018-02-28T01:59:02Z")

</div>

Something is pruning me down to five copies. Maybe it is cloudformation?

The doc says all of the versions are kept: “These versions are not cleaned up by serverless, so make sure you use a plugin or other tool to prune sufficiently old versions. The framework can’t clean up versions because it doesn’t have information about whether older versions are invoked or not. This feature adds to the number of total stack outputs and resources because a function version is a separate resource from the function it refers to.”
