Pulse
Pulse AWS

Pulse AWS reference

CLI flags and Python API exports

CLI flags and Python exports for pulse-aws.

CLI: pulse-aws

Unverified examples. Not run in this update.

pulse-aws deploy [options]
pulse-aws verify [options]
pulse-aws teardown [options]

deploy

OptionEnvDefaultNotes
--deployment-namePULSE_AWS_DEPLOYMENT_NAMEnonerequired
--domainPULSE_AWS_DOMAINnonerequired; used for ACM + default server address
--server-addressPULSE_SERVER_ADDRESShttps://<domain>overrides PULSE_SERVER_ADDRESS
--app-filePULSE_AWS_APP_FILEmain.pyrelative to build context; sets APP_FILE
--web-rootPULSE_AWS_WEB_ROOTwebrelative to build context; sets WEB_ROOT
--dockerfilePULSE_AWS_DOCKERFILEDockerfilehost path; resolved from the directory where you run pulse-aws
--contextPULSE_AWS_CONTEXT.host path; resolved from the directory where you run pulse-aws
--cdk-binPULSE_AWS_CDK_BINcdkbare names use PATH; path-like values resolve from the directory where you run pulse-aws
--cdk-workdirPULSE_AWS_CDK_WORKDIRpackaged pulse_aws/cdk apphost path; resolved from the directory where you run pulse-aws
--build-argnonenonerepeatable KEY=VALUE
--task-envnonenonerepeatable KEY=VALUE
--task-cpuPULSE_AWS_TASK_CPU256ECS CPU units (string)
--task-memoryPULSE_AWS_TASK_MEMORY512ECS memory (string)
--desired-countPULSE_AWS_DESIRED_COUNT2ECS desired task count
--drain-poll-secondsPULSE_AWS_DRAIN_POLL_SECONDS5SSM poll interval
--drain-grace-secondsPULSE_AWS_DRAIN_GRACE_SECONDS20drain grace period
--health-check-pathPULSE_AWS_HEALTH_CHECK_PATH/_pulse/healthALB health path
--health-check-intervalPULSE_AWS_HEALTH_CHECK_INTERVAL30seconds
--health-check-timeoutPULSE_AWS_HEALTH_CHECK_TIMEOUT5seconds
--healthy-thresholdPULSE_AWS_HEALTHY_THRESHOLD2successes to be healthy
--unhealthy-thresholdPULSE_AWS_UNHEALTHY_THRESHOLD3failures to be unhealthy
--wait-for-health / --no-wait-for-healthPULSE_AWS_WAIT_FOR_HEALTHtruegate traffic switch
--min-healthy-targetsPULSE_AWS_MIN_HEALTHY_TARGETS2minimum healthy targets

Defaults applied even when omitted:

  • Docker build args always include APP_FILE, WEB_ROOT, PULSE_SERVER_ADDRESS.
  • ECS task env always includes PULSE_SERVER_ADDRESS.
  • CDK commands run against the packaged pulse_aws/cdk app unless --cdk-workdir is set.

Path rules:

  • Host-path flags resolve from the directory where you run pulse-aws.
  • --app-file and --web-root are Docker-context paths, not host paths.

verify

OptionEnvDefaultNotes
--deployment-namePULSE_AWS_DEPLOYMENT_NAMEnonerequired
--domainPULSE_AWS_DOMAINnoneoptional; used for sample curl output
--health-check-pathPULSE_AWS_HEALTH_CHECK_PATH/_pulse/healthALB health path
--verify-ssl / --no-verify-sslPULSE_AWS_VERIFY_SSLfalseSSL verification for ALB calls

teardown

OptionEnvDefaultNotes
--deployment-namePULSE_AWS_DEPLOYMENT_NAMEnonerequired
--forcenonefalseskip active service checks
--yesnonefalseskip confirmation prompt
--poll-intervalPULSE_AWS_POLL_INTERVAL5seconds; float allowed
--regionAWS_REGION / AWS_DEFAULT_REGIONnoneoverride AWS region

Python API exports

from pulse_aws import (
    AWSECSPlugin,
    DeploymentError,
    DockerBuild,
    HealthCheckConfig,
    ReaperConfig,
    TaskConfig,
    deploy,
)

DockerBuild

DockerBuild(
    dockerfile_path: Path,
    context_path: Path,
    build_args: dict[str, str] = {},
)
  • dockerfile_path: path to Dockerfile.
  • context_path: Docker build context.
  • build_args: extra docker build args.

TaskConfig

TaskConfig(
    cpu: str = "256",
    memory: str = "512",
    desired_count: int = 2,
    env_vars: dict[str, str] = {},
    drain_poll_seconds: int = 5,
    drain_grace_seconds: int = 20,
)

HealthCheckConfig

HealthCheckConfig(
    path: str = "/_pulse/health",
    interval_seconds: int = 30,
    timeout_seconds: int = 5,
    healthy_threshold: int = 2,
    unhealthy_threshold: int = 3,
    wait_for_health: bool = True,
    min_healthy_targets: int = 2,
    task_grace_period_seconds: int = 60,
)

ReaperConfig

ReaperConfig(
    schedule_minutes: int = 1,
    max_age_hours: float = 1.0,
    deployment_timeout: float = 1.0,
)

deploy

async def deploy(
    *,
    domain: str,
    deployment_name: str,
    docker: DockerBuild,
    task: TaskConfig | None = None,
    health_check: HealthCheckConfig | None = None,
    reaper: ReaperConfig | None = None,
    certificate_arn: str | None = None,
    cdk_bin: str = "cdk",
    cdk_workdir: Path | str | None = None,
) -> dict[str, str]:
    ...

cdk_bin points to the CDK executable or wrapper script.

cdk_workdir is an advanced override that points deploy at a custom CDK app directory. If omitted, pulse-aws uses the packaged CDK app that ships inside pulse_aws/cdk.

Return keys:

  • deployment_id
  • service_arn
  • target_group_arn
  • task_def_arn
  • image_uri
  • cluster_name
  • alb_dns_name
  • marked_draining_count
  • certificate_arn
  • domain_ready
  • domain_proxied

DeploymentError

Raised when deployment operations fail.

AWSECSPlugin

Required env vars (prod/ci):

  • PULSE_AWS_DEPLOYMENT_NAME
  • PULSE_AWS_DEPLOYMENT_ID
  • PULSE_AWS_DRAIN_POLL_SECONDS
  • PULSE_AWS_DRAIN_GRACE_SECONDS

Optional env vars:

  • ECS_CONTAINER_METADATA_URI_V4 (auto in ECS)
  • PULSE_AWS_TASK_ID (fallback task id)

Behavior:

  • polls SSM for drain state
  • writes task readiness state to SSM
  • adds pulse_deployment to prerender and Socket.IO query directives for existing render sessions. New tabs/sessions do not send this query unless they reuse those same directives.
  • exposes /_pulse/meta as a deployment-metadata endpoint used by pulse-aws verify
  • Uses ALB target-group lb_cookie stickiness to keep requests on the same ECS task within a matched deployment.
  • New sessions without the affinity query follow the default listener action, which is the latest deployment.

In dev, missing required vars disables the plugin. In prod/ci, missing vars raise on startup.

See also

On this page