# How do I use rotating secrets from AWS Secrets Manager with GE's datasource credentials?

**URL:** https://discourse.greatexpectations.io/t/how-do-i-use-rotating-secrets-from-aws-secrets-manager-with-ges-datasource-credentials/119
**Category:** Archive
**Created:** [May 12, 2020, 7:36pm UTC](https://discourse.greatexpectations.io/t/how-do-i-use-rotating-secrets-from-aws-secrets-manager-with-ges-datasource-credentials/119 "2020-05-12T19:36:21Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![rohit.parulkar](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.greatexpectations.io/rohit.parulkar/32/49_2.png) [@rohit.parulkar](https://discourse.greatexpectations.io/u/rohit.parulkar)
#### Post date: [May 13, 2020, 6:04pm UTC](https://discourse.greatexpectations.io/t/how-do-i-use-rotating-secrets-from-aws-secrets-manager-with-ges-datasource-credentials/119/2 "2020-05-13T18:04:16Z")

</div>

Was able to figure this out with some help.

1. Configure the Redshift datasource to use environmental variables, as Eugene explained in [this helpful post](https://discourse.greatexpectations.io/t/environment-variable-substitution-is-not-working-for-me-when-connecting-ge-to-my-database/72).

```auto
datasources:
    datawarehouse:
        class_name: SqlAlchemyDatasource
        data_asset_type:
            class_name: SqlAlchemyDataset
        module_name:
        credentials:
            drivername: postgresql+psycopg2
            host: myRedshiftHost
            port: '5439'
            database: myRedshiftDb
            username: ${GE_REDSHIFT_USERNAME}
            password: ${GE_REDSHIFT_PASSWORD}

```

1. Before invoking GE, set environmental variables using a separate python script. See this [StackOverflow post](https://stackoverflow.com/questions/44243169/connect-to-redshift-using-python-using-iam-role) for an explanation of how to do in boto3.

```auto
    cluster_creds = boto3.client('redshift').get_cluster_credentials(DbUser=RedshiftUser,
                                               DbName=RedshiftDb,
                                          ClusterIdentifier=RedshiftClusterId,
                                               AutoCreate=False)
os.environ['GE_REDSHIFT_USERNAME'] = cluster_creds['DbUser']
os.environ['GE_REDSHIFT_PASSWORD'] = cluster_creds['DbPassword']

```

---

_[View the full topic](https://discourse.greatexpectations.io/t/how-do-i-use-rotating-secrets-from-aws-secrets-manager-with-ges-datasource-credentials/119)._
