https://prefect.io logo
Title
n

Nathaniel Russell

08/26/2022, 4:35 PM
storage = S3(
    bucket=s3_bucket_name,
    key=f"flows/banner_canvas_flow.py",
    stored_as_script=True,
    local_script_path=f"flows/banner_canvas_flow.py"
)
In prefect 1.0 I could store my task code in an S3 bucket and use that implementation of the tasks whenever I ran a flow with storage=storage. How would I accomplish this in prefect 2.0?
1
r

Ryan Peden

08/26/2022, 4:43 PM
Hi Nathaniel, to do this in Prefect 2, you would use an S3 storage block, which you can create either in Python or via the UI. There's an S3 example in the docs here: https://docs.prefect.io/concepts/storage/ Once you've created an S3 block, you can reference it when you create a deployment. Then, any time you apply the deployment your flow code will be copied to S3 and used whenever your flow runs.