Do I need a custom ECR image for my agent or can m...
# prefect-community
k
Hey guys! I have a Prefect Agent running as an ECS Service. It is uses a lightweight container and will be invoking deployments via
ECSTask
. My question: Do I need to install dependencies like
prefect-aws
,
s3fs
etc. and register the blocks (eg:
prefect block register -m prefect_aws.ecs
) in the container for the agent? Or can I just use the latest
prefecthq/prefect
image?
👍 1
1
I'm currently using this Dockerfile:
Copy code
FROM prefecthq/prefect:2-python3.10

# Install dependencies
COPY requirements.txt .
RUN pip install -r requirements.txt --no-cache-dir

# Register AWS block types
RUN prefect block register -m prefect_aws.ecs
But I think this might be unused / redundant
a
Your intuition is right, you can use the latest
prefecthq/prefect
image for your agent
1
the ECSTask block has all attributes needed, agent can be super lightweight and only needs prefect as a dependency we have this repo template with a blog post and video tutorial linked in the readme https://github.com/anna-geller/dataflow-ops
k
Thank you! And yes, this repo has been instrumental to our approach! I just ran my first prefect deployment as an ECS Task yesterday! Now, I'm setting up some workflows to keep things updated
🙏 2
👍 3
a
awesome, so great to hear and keep us posted how it goes! 🙌
k
Hey Just wanted to update that you do infact need to install
prefect-aws
if you plan to use
ECSTask
. I ran into a
KeyError: ecs-task
could not be dispatched Also, I recently switched from
S3
to private
GitHub
and I had to install
git
on the
prefect
container's image in my
ECSTask
definition