# Discovering my RDS connection details

**URL:** https://forum.serverless.com/t/discovering-my-rds-connection-details/5908
**Category:** Serverless Framework
**Tags:** aws
**Created:** [September 21, 2018, 9:18pm UTC](https://forum.serverless.com/t/discovering-my-rds-connection-details/5908 "2018-09-21T21:18:41Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![hitechbunny](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/hitechbunny/32/2572_2.png) [@hitechbunny](https://forum.serverless.com/u/hitechbunny)
#### Post date: [September 21, 2018, 9:18pm UTC](https://forum.serverless.com/t/discovering-my-rds-connection-details/5908/1 "2018-09-21T21:18:41Z")

</div>

Hey there,

I’m fairly new to serverless. I have python functions deployed, and that’s all working well. Now I’m trying to setup and use an RDS resource. Here’s where I’m getting stuck. I’ve successfully created an RDS instance, but I’m at a loss for how I’m supposed to auto-discover the DATABASE\_URL to connect to it. I presume there’s a special ${…} syntax I can use in the environment section .

Any help much appreciated!

My configuration looks like this:

```
resources:
  Resources:
    MarketDB: 
      Type: AWS::RDS::DBInstance
      Properties: 
        DBName: "MarketDB"
        AllocatedStorage: "5"
        DBInstanceClass: "db.t2.small"
        Engine: "MySQL"
        EngineVersion: "5.7.22"
        MasterUsername: "xxx"
        MasterUserPassword: "xxx"
      DeletionPolicy: "Snapshot"

```

Cheers,  
Hitechbunny

---

<div class="post-metadata">

### Author: ![RafalWilinski](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/rafalwilinski/32/341_2.png) [@RafalWilinski](https://forum.serverless.com/u/RafalWilinski)
#### Post date: [September 23, 2018, 1:22pm UTC](https://forum.serverless.com/t/discovering-my-rds-connection-details/5908/2 "2018-09-23T13:22:38Z")

</div>

Value that you’re looking for is exposed in resource output as `Endpoint.Address` ([https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html) section Return Values).

Then, you can pass it to your Lambda function using `Fn:GetAtt` like this:

```
functions:
  helloFunction:
    environment:
      DATABASE_URL: 
        Fn::GetAtt:
          - MarketDB
          - Endpoint.Address
```

---

<div class="post-metadata">

### Author: ![hitechbunny](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/hitechbunny/32/2572_2.png) [@hitechbunny](https://forum.serverless.com/u/hitechbunny)
#### Post date: [September 28, 2018, 7:07pm UTC](https://forum.serverless.com/t/discovering-my-rds-connection-details/5908/3 "2018-09-28T19:07:30Z")

</div>

Awesome! Thank you so much. 🙂
