{
  "name": "pg-dump-to-s3",
  "title": "Back up PostgreSQL to S3",
  "category": "Databases",
  "tags": [
    "aws-cli",
    "databases",
    "postgres"
  ],
  "version": "1.0.0",
  "date": "2026-10-18",
  "notes": "Initial release.",
  "latest": true,
  "installable": true,
  "url": "https://catalog.dagweave.com/api/v1/items/pg-dump-to-s3/1.0.0.json",
  "templateUrl": "https://catalog.dagweave.com/api/v1/items/pg-dump-to-s3/1.0.0/template.yaml",
  "entrypoint": "backup",
  "parameters": [
    {
      "name": "bucket",
      "title": "Bucket",
      "description": "S3 bucket to put the dump in, without the s3:// prefix.",
      "type": "string",
      "required": true,
      "example": "acme-db-backups"
    },
    {
      "name": "database",
      "title": "Database",
      "description": "Database to connect to.",
      "type": "string",
      "required": true
    },
    {
      "name": "host",
      "title": "Host",
      "description": "PostgreSQL server host.",
      "type": "string",
      "required": true,
      "example": "db.internal"
    },
    {
      "name": "key",
      "title": "Key",
      "description": "Object key for the dump file.",
      "type": "string",
      "required": true,
      "example": "checkout/2026-10-18.dump"
    },
    {
      "name": "user",
      "title": "User",
      "description": "User to connect as.",
      "type": "string",
      "required": true
    },
    {
      "name": "aws-access-key-id-key",
      "title": "Aws access key id key",
      "description": "Key in that Secret that holds the access key id.",
      "type": "string",
      "required": false,
      "default": "access-key-id"
    },
    {
      "name": "aws-secret-access-key-key",
      "title": "Aws secret access key key",
      "description": "Key in that Secret that holds the secret access key.",
      "type": "string",
      "required": false,
      "default": "secret-access-key"
    },
    {
      "name": "aws-secret-name",
      "title": "Aws secret name",
      "description": "Name of the Kubernetes Secret that holds the AWS credentials.",
      "type": "string",
      "required": false,
      "default": "aws-credentials"
    },
    {
      "name": "password-secret-key",
      "title": "Password secret key",
      "description": "Key in that Secret that holds the password.",
      "type": "string",
      "required": false,
      "default": "password"
    },
    {
      "name": "password-secret-name",
      "title": "Password secret name",
      "description": "Name of the Kubernetes Secret that holds the user's password.",
      "type": "string",
      "required": false,
      "default": "postgres-password"
    },
    {
      "name": "port",
      "title": "Port",
      "description": "PostgreSQL server port.",
      "type": "string",
      "required": false,
      "default": "5432"
    },
    {
      "name": "region",
      "title": "Region",
      "description": "AWS region of the resource.",
      "type": "string",
      "required": false,
      "default": "us-east-1"
    }
  ],
  "images": [
    {
      "ref": "cgr.dev/chainguard/postgres@sha256:dfc3fba4527ef4bf91eaf9ee518589447f4f2ca3bea47c914bc50e959b3721cb",
      "repository": "cgr.dev/chainguard/postgres",
      "tag": "latest-dev",
      "digest": "sha256:dfc3fba4527ef4bf91eaf9ee518589447f4f2ca3bea47c914bc50e959b3721cb"
    },
    {
      "ref": "amazon/aws-cli@sha256:d557b3524475d70dd3104cf44d96568ee3188897b73a6ece2b37aa50e1af362f",
      "repository": "amazon/aws-cli",
      "tag": "2.39.3",
      "digest": "sha256:d557b3524475d70dd3104cf44d96568ee3188897b73a6ece2b37aa50e1af362f"
    }
  ],
  "install": {
    "kubectl": "kubectl apply -n argo -f https://catalog.dagweave.com/api/v1/items/pg-dump-to-s3/1.0.0/template.yaml",
    "argo": "argo template create -n argo https://catalog.dagweave.com/api/v1/items/pg-dump-to-s3/1.0.0/template.yaml"
  },
  "template": "apiVersion: argoproj.io/v1alpha1\nkind: WorkflowTemplate\nmetadata:\n  name: pg-dump-to-s3\n  labels:\n    dagweave.io/catalog-item: pg-dump-to-s3\n  annotations:\n    dagweave.io/catalog-version: \"1.0.0\"\n    dagweave.io/catalog-category: \"Databases\"\nspec:\n  entrypoint: backup\n  templates:\n    - name: backup\n      inputs:\n        parameters:\n          - name: host\n          - name: port\n            default: \"5432\"\n          - name: database\n          - name: user\n          - name: bucket\n          - name: key\n          - name: password-secret-name\n            default: \"postgres-password\"\n          - name: password-secret-key\n            default: \"password\"\n          - name: region\n            default: \"us-east-1\"\n          - name: aws-secret-name\n            default: \"aws-credentials\"\n          - name: aws-access-key-id-key\n            default: \"access-key-id\"\n          - name: aws-secret-access-key-key\n            default: \"secret-access-key\"\n      retryStrategy:\n        limit: \"2\"\n        retryPolicy: OnError\n        backoff:\n          duration: 10s\n          factor: \"2\"\n          maxDuration: 2m\n      volumes:\n        - name: dump\n          emptyDir: {}\n      containerSet:\n        volumeMounts:\n          - name: dump\n            mountPath: /dump\n        containers:\n          - name: dump\n            # cgr.dev/chainguard/postgres:latest-dev\n            image: cgr.dev/chainguard/postgres@sha256:dfc3fba4527ef4bf91eaf9ee518589447f4f2ca3bea47c914bc50e959b3721cb\n            command: [sh, -c]\n            args:\n              - |\n                set -eu\n                pg_dump --format=custom --file=/dump/db.dump\n                ls -l /dump/db.dump\n            env:\n              - name: PGHOST\n                value: \"{{inputs.parameters.host}}\"\n              - name: PGPORT\n                value: \"{{inputs.parameters.port}}\"\n              - name: PGDATABASE\n                value: \"{{inputs.parameters.database}}\"\n              - name: PGUSER\n                value: \"{{inputs.parameters.user}}\"\n              - name: PGPASSWORD\n                valueFrom:\n                  secretKeyRef:\n                    name: \"{{inputs.parameters.password-secret-name}}\"\n                    key: \"{{inputs.parameters.password-secret-key}}\"\n            resources:\n              requests:\n                cpu: 100m\n                memory: 128Mi\n              limits:\n                memory: 512Mi\n          - name: main\n            dependencies: [dump]\n            # amazon/aws-cli:2.39.3\n            image: amazon/aws-cli@sha256:d557b3524475d70dd3104cf44d96568ee3188897b73a6ece2b37aa50e1af362f\n            command: [sh, -c]\n            args:\n              - |\n                set -eu\n                aws s3 cp /dump/db.dump \"s3://${S3_BUCKET}/${S3_KEY}\" --only-show-errors\n            env:\n              - name: S3_BUCKET\n                value: \"{{inputs.parameters.bucket}}\"\n              - name: S3_KEY\n                value: \"{{inputs.parameters.key}}\"\n              - name: AWS_DEFAULT_REGION\n                value: \"{{inputs.parameters.region}}\"\n              - name: AWS_ACCESS_KEY_ID\n                valueFrom:\n                  secretKeyRef:\n                    name: \"{{inputs.parameters.aws-secret-name}}\"\n                    key: \"{{inputs.parameters.aws-access-key-id-key}}\"\n              - name: AWS_SECRET_ACCESS_KEY\n                valueFrom:\n                  secretKeyRef:\n                    name: \"{{inputs.parameters.aws-secret-name}}\"\n                    key: \"{{inputs.parameters.aws-secret-access-key-key}}\"\n            resources:\n              requests:\n                cpu: 100m\n                memory: 256Mi\n              limits:\n                memory: 512Mi\n",
  "templateSha256": "168ee8bf2e1dfdc729ff970ef0ac31bbc3ad30e19fbf082be67911328c709737",
  "source": "https://github.com/dagweave/catalog/tree/67458f74dbbf913b03177f3cefc69424be85eb1d/catalog/pg-dump-to-s3",
  "catalogSha": "67458f74dbbf913b03177f3cefc69424be85eb1d"
}
