https://prefect.io logo
Title
d

Daniel Burkhardt

02/28/2022, 9:22 PM
Hi all, what's the best practice around using RDS postgres database authentication for Prefect Agents on AWS? Do folks use IAM database authentication or Postgres Native Authentication?
a

Anna Geller

02/28/2022, 9:58 PM
for Prefect agents, you can authenticate just using the API key from your Prefect Cloud account. You can do:
prefect agent local start --key YOURKEY --label YOURLABEL
or did I misunderstand something? can you explain what do you try to do? if you try to authenticate with your RDS DB from a Postgres task, you can provide user and password, so I guess this would be Postgres Native Authentication (rather than IAM-based)
a

Amanda Wee

02/28/2022, 9:59 PM
I don't know if it is best practice, but in my case I put
postgresql://<username>:<password>@<cluster>.<http://rds.amazonaws.com:5432/prefect_server|rds.amazonaws.com:5432/prefect_server>
in the parameter store, then provided it for the task definitions for my hasura and graphql containers of prefect server. But note that I did it this way because my company required me to use ECS tasks rather than EC2 instances directly (and at the time prefect cloud was too expensive, according to my then-team lead's determination). The prefect agent itself (also running as an ECS task) didn't need to connect to the database since it connected to prefect server instead.
:upvote: 3