<@ULVA73B9P> Can I use Deployment.build_from_flow ...
# ask-marvin
k
@Marvin Can I use Deployment.build_from_flow function for deployment in prefect 2.13.8?
n
at that point, yes
Deployment.build_from_flow
should still be present in the SDK
k
@Marvin but can it be used with S3Bucket?
m
To provide you with an accurate response, I need to know which version of Prefect you are using, as integrations with services like S3 can differ between versions. Could you please confirm whether you are using Prefect 2.x or 3.x?
k
@Marvin I am using version 2.13.8
m
Great! Since you're using Prefect version 2.13.8, I'll assist you based on the features and capabilities of Prefect 2.x. If you have any specific questions or need help with Prefect, feel free to ask!
k
@Marvin can I use Deployment.build_from_flow function with S3Bucket or I can use S3?
@Marvin can I use Deployment.build_from_flow function with S3Bucket or I can use S3?
n
sorry, there's some sort of outage I haven't identified yet you should be able to use either
m
To provide you with the most accurate response, I need to verify which version of Prefect you are using, as functionality can vary between versions. Can you please confirm if you are using Prefect 2.x, 3.x, or another version?
k
@Marvin I am using version 2.13.8
m
In Prefect version 2.13.8, you can indeed use
Deployment.build_from_flow
with an S3 bucket for flow storage. You can pass the S3 bucket path directly to the source when you build your deployment. Additionally, if you require specific configuration for a private S3 bucket, you can use a storage block from the
prefect_aws
library, such as
S3Bucket
, to ensure that credentials are accessible during deployment creation and execution. Here's a brief example of how to use an S3 bucket path in your flow deployment:
Copy code
python
from prefect import Deployment
from prefect_aws.s3 import S3Bucket

deployment = Deployment.build_from_flow(
    flow=my_flow,
    name="my-deployment",
    storage=S3Bucket(bucket_name="my-bucket", key="my-folder")
)
You can find more about working with Prefect and S3 in these resources: - Prefect Deployment Guide - Prefect AWS Integration Guide If you have any further questions, feel free to ask!
k
@Marvin there documentation are for 2.20.10 and I am using 2.13.8
m
I understand your concern. Although the documentation links provided are for a more recent version, the functionality described regarding using S3 with
Deployment.build_from_flow
should still broadly apply to version 2.13.8. Prefect's backward compatibility often maintains such fundamental features across patch versions. However, it's worth noting that differences might exist in certain defaults or minor configurations. If you encounter any specific functionality that does not work as described, it may be due to these version discrepancies, and I would recommend consulting the Prefect GitHub repository or querying specific release notes for detailed changes between versions. If you need further assistance tailored specifically to version 2.13.8, please let me know, and I can try to assist you with more detailed queries.
k
@Marvin can we still use S3 from prefect or need to switch to S3Bucket?
m
It appears that in Prefect 2.13.8 and later versions, the S3 bucket storage using the
S3Bucket
block from the
prefect_aws
library is recommended over the older S3 storage methods. This shift is part of a broader move towards using blocks in Prefect, which are more flexible and ensure that configurations like credentials are properly managed and accessible during deployment creation and execution. While you might still find some ways to utilize S3 directly, transitioning to the
S3Bucket
block is encouraged, as this aligns with the current best practices in Prefect and offers better compatibility with Prefect's deployment models and infrastructure. For more guidance on setting up
S3Bucket
in Prefect, you can refer to their documentation on S3 with Prefect and Storage Concepts. Feel free to ask if you need more clarification or help with anything else!