Hey y’all. I’m new to Prefect and I think it’s rad. The local version of Prefect is easy enough, but I’m a little confused by secrets in Prefect Cloud. I’m trying to write to a Postgres RDS instance on AWS. The script I’m using writes to an existing table with
<http://pandas.to|pandas.to>_sql
. Apologies if this is answered in docs somewhere, but how do I pass my secrets to Prefect Cloud? I have 2 cases. In the first case I can run the script locally and pass the secrets as env vars, but in the second case, I’m hoping to run the job on Prefect Cloud once a week. Any help would be great! Thanks.
k
Kevin Kho
03/24/2022, 3:38 PM
Hi @John Ramey, for Cloud you set you secret ahead of time, And then you invoke it from your Flow:
Copy code
with Flow(...) as flow:
PrefectSecret("YOUR_SECRET")
If you want to use it in the a task, you can do
Copy code
Secret("YOUR_SECRET").get()
and then it will fetch it during runtime and your Flow is executing. Does that make sense?
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.