What are the lines that I need for a flow deployme...
# prefect-getting-started
z
What are the lines that I need for a flow deployment to cloud api server? My first guess is below, but not sure where to put the api key/url. For whatever it's worth, the script will be running in a lambda container.
Copy code
deployment = Deployment.build_from_flow(
flow=artist_ranker_etl,
name="artist-ranker-deployment",
entrypoint="artist_ranker.main.handler",
)
deployment.apply()
1
r
two env vars PREFECT_API_KEY and PREFECT_API_URL
👍 1
z
okay, can these be passed to a prefect function?
j
I believe you don't want to. You just need them in the
env
.
export
each variable and the function will pick it up during runtime. In the case of lambda you could store each in AWS SSM, have the function retrieve them using
boto3
, export them using
os.environ
, then try building and applying your deployment.
👍 1
z
I haven't used SSM before, but if what you are saying is true then I should be able to simply set them as environment variables under a lambda's configuration settings.
r
yup
👍 1
z
Have any of you come across this error from Deployment.build_from_flow()? [ERROR] JSONDecodeError: Expecting value: line 1 column 1 (char 0) Traceback (most recent call last):
r
sounds like an invalid server response, is your api url set correctly
👍 1
z
hm, checking...
Yep, that was the issue. Wrong format.
👍 2