# Overwriting Variables on the fly with plugin

**URL:** https://forum.serverless.com/t/overwriting-variables-on-the-fly-with-plugin/2611
**Category:** Serverless Framework
**Created:** [August 31, 2017, 4:52am UTC](https://forum.serverless.com/t/overwriting-variables-on-the-fly-with-plugin/2611 "2017-08-31T04:52:04Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![anantab](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/anantab/32/2373_2.png) [@anantab](https://forum.serverless.com/u/anantab)
#### Post date: [August 31, 2017, 4:52am UTC](https://forum.serverless.com/t/overwriting-variables-on-the-fly-with-plugin/2611/1 "2017-08-31T04:52:04Z")

</div>

I want to write a plugin that automatically encrypts lamda environment variables before a cloudformation package is created. Any ideas on how this can be done ? I cannot figure how to get variables in my plugin after serverless has loaded them.

---

<div class="post-metadata">

### Author: ![rowanu](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/rowanu/32/75_2.png) [@rowanu](https://forum.serverless.com/u/rowanu)
#### Post date: [September 11, 2017, 9:53pm UTC](https://forum.serverless.com/t/overwriting-variables-on-the-fly-with-plugin/2611/2 "2017-09-11T21:53:30Z")

</div>

Not really an answer to your original question, but perhaps an alternative approach: [https://hackernoon.com/you-should-use-ssm-parameter-store-over-lambda-env-variables-5197fc6ea45b](https://hackernoon.com/you-should-use-ssm-parameter-store-over-lambda-env-variables-5197fc6ea45b)

---

<div class="post-metadata">

### Author: ![anantab](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/anantab/32/2373_2.png) [@anantab](https://forum.serverless.com/u/anantab)
#### Post date: [September 11, 2017, 11:11pm UTC](https://forum.serverless.com/t/overwriting-variables-on-the-fly-with-plugin/2611/3 "2017-09-11T23:11:57Z")

</div>

Thanks Rowanu. Actually I already figured out what I was doing wrong and was able to solve my problem. But SSM parameter could be very useful in my project as I am sharing same environment variables across multiple Lamda functions.
