https://prefect.io logo
#prefect-community
Title
# prefect-community
j

John Ramey

03/24/2022, 3:34 PM
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?
j

John Ramey

03/24/2022, 4:48 PM
first off, thanks for the link. i had seen only the link for Prefect core: https://docs.prefect.io/core/concepts/secrets.html
I’m new to tasks so let me play with this a little. I’ll reach out with more questions as they come up. Thanks @Kevin Kho
k

Kevin Kho

03/24/2022, 4:53 PM
Sounds good!
16 Views