# Write serverless invoke return output to file

**URL:** <https://forum.serverless.com/t/write-serverless-invoke-return-output-to-file/11002>\
**Category:** Serverless Framework\
**Tags:** aws, lambda\
**Created:** [April 3, 2020, 3:23pm UTC](https://forum.serverless.com/t/write-serverless-invoke-return-output-to-file/11002 "2020-04-03T15:23:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ryanpodonnell1](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/ryanpodonnell1/32/4104_2.png) [@ryanpodonnell1](https://forum.serverless.com/u/ryanpodonnell1)\
**Post date:** [April 3, 2020, 3:23pm UTC](https://forum.serverless.com/t/write-serverless-invoke-return-output-to-file/11002/1 "2020-04-03T15:23:38Z")

</div>

Hi,

I would like to invoke a function with serverless, have the value that is returned by my lambda written to a file.

The idea is that I can run this command and invoke the first function:  
`serverless invoke -f routemanager_plan --region us-east-1 --log -p routemanager_plan/event.json`

have the return value written to a file:  
`output_routemanager_plan.json`

and then have a second function consume that file:  
`serverless invoke -f routemanager_apply --region us-east-1 --log -p output_routemanager_plan.json`

is there any native way of doing this in serverless? Ideally I’d like to just add a flag of something like `-w output_routemanager_plan.json` to the end of my first invoke command

---

<div class="post-metadata">

**Author:** ![ryanpodonnell1](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/ryanpodonnell1/32/4104_2.png) [@ryanpodonnell1](https://forum.serverless.com/u/ryanpodonnell1)\
**Post date:** [April 3, 2020, 4:39pm UTC](https://forum.serverless.com/t/write-serverless-invoke-return-output-to-file/11002/2 "2020-04-03T16:39:55Z")

</div>

This actually worked for my needs, I was able to pass the output of one function as input data to another

```auto
serverless invoke -f routemanager_apply \
--region us-east-1 \
-d "$(serverless invoke -f routemanager_plan --region us-east-1 -p routemanager_plan/event.json)" \
--log

```
