# Hashicorp Vault and Postgres - how to assign users to group?

**URL:** <https://discuss.hashicorp.com/t/hashicorp-vault-and-postgres-how-to-assign-users-to-group/4367>\
**Category:** Vault\
**Created:** [December 4, 2019, 7:00am UTC](https://discuss.hashicorp.com/t/hashicorp-vault-and-postgres-how-to-assign-users-to-group/4367 "2019-12-04T07:00:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![omersi](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/omersi/32/3456_2.png) [@omersi](https://discuss.hashicorp.com/u/omersi)\
**Post date:** [December 4, 2019, 7:00am UTC](https://discuss.hashicorp.com/t/hashicorp-vault-and-postgres-how-to-assign-users-to-group/4367/1 "2019-12-04T07:00:08Z")

</div>

I use vault to generate users on Postgres, Redshift. In postgres and redshift I have predefined groups with permissions (ro/rw) and I want to add the users created by Vault to the corresponding group. I tried using

in postgres:

`CREATE USER \"{{username}}\" WITH PASSWORD '{{password}}' IN GROUP {group_name}'`

in redshift

`'CREATE USER \"{{username}}\" WITH PASSWORD '{{password}}' VALID UNTIL '{{date}}'; ALTER GROUP {group_name} ADD USER \"{{username}}\";'`

with out any luck… it generates error messages of encoding.

what’s the best practice for such case? as per the Vault instance - it’s a fargate cluster and I don’t have direct access to it… 😕

---

<div class="post-metadata">

**Author:** ![ixe013](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/ixe013/32/2605_2.png) [@ixe013](https://discuss.hashicorp.com/u/ixe013)\
**Post date:** [December 4, 2019, 2:04pm UTC](https://discuss.hashicorp.com/t/hashicorp-vault-and-postgres-how-to-assign-users-to-group/4367/2 "2019-12-04T14:04:27Z")

</div>

Can you post the full error message?
