# Passing ServerlessDeploymentBucket as environment variable

**URL:** <https://forum.serverless.com/t/passing-serverlessdeploymentbucket-as-environment-variable/12173>\
**Category:** Serverless Framework\
**Tags:** aws\
**Created:** [August 2, 2020, 10:01am UTC](https://forum.serverless.com/t/passing-serverlessdeploymentbucket-as-environment-variable/12173 "2020-08-02T10:01:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mg98](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/mg98/32/4835_2.png) [@mg98](https://forum.serverless.com/u/mg98)\
**Post date:** [August 2, 2020, 10:01am UTC](https://forum.serverless.com/t/passing-serverlessdeploymentbucket-as-environment-variable/12173/1 "2020-08-02T10:01:41Z")

</div>

My lambda function needs to work with a S3 bucket to store and retrieve one file. I created a resource for that until I figured out this won’t work for other AWS accounts, because the name must be universally unique.

So I thought it would be cleaner anyway if I just use the ServerlessDeploymentBucket. My approach to pass the bucket name to my nodejs app was through an environment variable.

In **serverless.yml** I tried with:

```
environment:
  SERVERLESS_BUCKET: 
    Ref: 'ServerlessDeploymentBucket'

```

`console.log(process.env.SERVERLESS_BUCKET)` would just output a “[object Object]”…
