# Get deployed API Gateway ID for testing automatically

**URL:** https://forum.serverless.com/t/get-deployed-api-gateway-id-for-testing-automatically/11396
**Category:** Serverless Framework
**Tags:** aws, api-gateway, variables
**Created:** [May 9, 2020, 1:06am UTC](https://forum.serverless.com/t/get-deployed-api-gateway-id-for-testing-automatically/11396 "2020-05-09T01:06:36Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![JeremiGendron](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/jeremigendron/32/4225_2.png) [@JeremiGendron](https://forum.serverless.com/u/JeremiGendron)
#### Post date: [May 9, 2020, 1:06am UTC](https://forum.serverless.com/t/get-deployed-api-gateway-id-for-testing-automatically/11396/1 "2020-05-09T01:06:37Z")

</div>

What would be the best way to save the value of the APIGateway’s ID (e.g. mb1j6zi3q0) automatically to a JSON file so it can be used by my testing suite?

I basically deploy a stack to AWS temporarily, run my tests against those deployed functions and tear it down.

Only issue is that the ID changes every deployment, so I need a way to save it to a file after each deploy to use it in my tests.

---

<div class="post-metadata">

### Author: ![bfieber](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/bfieber/32/653_2.png) [@bfieber](https://forum.serverless.com/u/bfieber)
#### Post date: [June 22, 2020, 11:01pm UTC](https://forum.serverless.com/t/get-deployed-api-gateway-id-for-testing-automatically/11396/2 "2020-06-22T23:01:46Z")

</div>

Have a gander at [serverless-stack-output plug-in](https://www.serverless.com/plugins/serverless-stack-output/)  
It will output the stack to a local file during deployment. Have your tests read in the value you need and viola!
