Hi :wave: We are using Prefct Cloud + ECS (push wo...
# ask-community
y
Hi 👋 We are using Prefct Cloud + ECS (push work pools). We want to use
pg_dump
to take a snapshot of a postgres database but having hard time installing
pg_dump
We’ve tried this inside the flow’s code:
Copy code
@flow(name="dump_postgres_to_s3", log_prints=True)
def dump_postgres_to_s3(connection_string: str):    
    result = subprocess.run(['apt-get', 'install', 'pg_dump'], stdout=subprocess.PIPE)
    print(result)
But the result is an error code 100:
Copy code
CompletedProcess(args=['apt-get', '--fix-broken', 'install', 'pg_dump'], returncode=100, stdout=b'Reading package lists...\nBuilding dependency tree...\nReading state information...\n')
From research, it looks like error code 100 means the is not available to be installed. So any idea how we can get pg_dump installed and used inside a Flow? Just to clarify: this runs inside an AWS ECS Task, which uses the default Prefect image
<http://docker.io/prefecthq/prefect:2.13.5-python3.10|docker.io/prefecthq/prefect:2.13.5-python3.10>
Thank you for any help on this 🙂
I’ve managed to solve this by creating a new docker image based on prefect’s image. The Dockerfile:
Copy code
FROM prefecthq/prefect:2.18.0-python3.10

RUN apt-get update && apt-get install --no-install-recommends --no-upgrade -y postgresql-client