[ aws . amplifygen3 . local ]

run

Description

Start your app locally. What starts depends on which blocks are active in amplify.jsonc:

  • backend: the local backend (gateway, Postgres database and auth) in a container, plus a Mailpit container that catches the email the backend sends.
  • deploy: your frontend dev server (the dev script in package.json), in the foreground, given the local backend URL and publishable key as AMPLIFY_BACKEND_URL and AMPLIFY_BACKEND_PUBLISHABLE_KEY.

With both, the backend starts first. With no amplify.jsonc, aws amplifygen3 local run fails: aws amplifygen3 local init writes it. Ctrl+C stops the dev server; aws amplifygen3 local stop stops the backend and the dev server too, with everything the dev server started, even from another terminal or after this command has gone.

What the command does

  1. Checks backend.auth in amplify.jsonc against the auth config schema, before anything starts.

  2. Pulls the local backend image, verifies its signature and runs it by digest. The image comes from public.ecr.aws/k2e6k2x7/local, with no login. –image-version pins a release. Offline, the command starts the image it last verified, for up to 7 days.

  3. Starts the backend and waits until it is healthy. A backend that is already running is kept as it is, unless amplify.jsonc (any part of it), .secrets/client_secrets.env, email-templates/ or the dev server’s origin changed since it started: then it is recreated, once the new config is shown to boot.

    Email templates in email-templates/ apply only when backend.auth names a real SMTP server reachable over TLS (STARTTLS, or implicit TLS on 465); the local Mailpit can’t serve as that server.

  4. Applies pending migrations/*.sql (–skip-migrations only reports them). A migration that fails fails the command and leaves the backend running.

  5. Starts the frontend dev server and prints the app, backend, database, local console and mail URLs.

Files the command reads and writes

In the project directory:

  • amplify.jsonc (read): which blocks to start, the app name and backend.auth. The command never changes it.
  • amplify.local.json (read and written, gitignored): this machine’s local state for the project. The command records the URLs and ports the backend got, the image it runs and the dev server’s port in its local section; the other aws amplifygen3 local commands read them to reach the backend. When the file is missing, the command creates it and adds it to .gitignore.
  • .secrets/db_password (read; created when missing, gitignored): the local database password.
  • .secrets/client_secrets.env (read): the values of the ${env:NAME} secrets backend.auth names.
  • migrations/*.sql (read): applied to the local database.

In your home directory, per user:

  • ~/.aws/amplifygen3/verified-image-tags.json: the image digests the command last verified, so it can start offline.

Ports

  • The backend URL is http://localhost:3001, the database listens on localhost:5432 and the local console (a browser UI, on localhost only) is http://localhost:54323; each moves to the next free port when taken.
  • A port recorded in amplify.local.json is reused, and moves only when another process holds it.
  • The mail catcher’s (Mailpit’s) web UI and API are on http://localhost:8025, and move and are recorded the same way; aws amplifygen3 local status shows where.
  • A port set with –port, –db-port, –gui-port or –mail-port never moves: the command fails when it is busy.
  • The dev server keeps its port between runs; PORT, or a port your dev script or dev server config sets, wins. The command fails before starting anything when the dev server and the backend would share a port.

Notes

  • Each checkout gets a local backend of its own (a clone or a worktree included), named after amplify.jsonc’s name and a hash of the checkout’s path. aws amplifygen3 local destroy in a checkout removes its backend.
  • A branch switch in one checkout keeps its backend and database: for data per branch, use one worktree per branch. The command warns when the backend was started from another checkout, and when the database holds migrations no file in migrations/ has.
  • The backend trusts the dev server’s origin, and the command warns when it does not.
  • Next.js and Create React App dev servers are given localhost as their host, so other devices cannot reach them, unless you set a host (the command warns when yours is not a loopback address).
  • When Mailpit does not start, the command warns and goes on; it warns again when backend.auth sends sign-up or sign-in email and sets no platform.customEmail.smtp server.

Synopsis

  run
[--port <value>]
[--db-port <value>]
[--gui-port <value>]
[--mail-port <value>]
[--rebuild]
[--image-version <value>]
[--no-verify-image-signature]
[--skip-migrations]
[--debug]
[--endpoint-url <value>]
[--no-verify-ssl]
[--no-paginate]
[--output <value>]
[--query <value>]
[--profile <value>]
[--region <value>]
[--version <value>]
[--color <value>]
[--no-sign-request]
[--ca-bundle <value>]
[--cli-read-timeout <value>]
[--cli-connect-timeout <value>]
[--cli-binary-format <value>]
[--no-cli-pager]
[--cli-auto-prompt]
[--no-cli-auto-prompt]
[--cli-error-format <value>]
[--help]

Options

--port (integer) Backend gateway port. Defaults to 3001, or the next free port.

--db-port (integer) Backend Postgres port. Defaults to 5432, or the next free port.

--gui-port (integer) Local console port. Defaults to 54323, or the next free port.

--mail-port (integer) Mail catcher (Mailpit) web UI and API port. Defaults to 8025, or the next free port.

--rebuild (boolean) Force re-pull of the backend runtime image.

--image-version (string) Run this release of the local backend image (for example 1.1.0) instead of the current one, also set by AWS_AMPLIFY_LOCAL_IMAGE_VERSION. Online it runs only once AWS Signer confirms it is not revoked, so it needs AWS credentials; when the registry cannot be read it runs, like the current release, the digest it named when last verified, for up to 7 days. The command warns on every start that it is pinned. A running stack keeps its image until aws amplifygen3 local stop.

--no-verify-image-signature (boolean) Run the local backend image without verifying its signature. It applies only to an image named by AWS_AMPLIFY_LOCAL_IMAGE: the released image always runs verified.

--skip-migrations (boolean) Do not apply pending migrations/*.sql after the backend boots; just report how many are pending (aws amplifygen3 local migration apply applies them).

Global Options

--debug (boolean)

Turn on debug logging.

--endpoint-url (string)

Override command’s default URL with the given URL.

--no-verify-ssl (boolean)

By default, the AWS CLI uses SSL when communicating with AWS services. For each SSL connection, the AWS CLI will verify SSL certificates. This option overrides the default behavior of verifying SSL certificates.

--no-paginate (boolean)

Disable automatic pagination. If automatic pagination is disabled, the AWS CLI will only make one call, for the first page of results.

--output (string)

The formatting style for command output.

  • json
  • text
  • table
  • yaml
  • yaml-stream
  • off

--query (string)

A JMESPath query to use in filtering the response data.

--profile (string)

Use a specific profile from your credential file.

--region (string)

The region to use. Overrides config/env settings.

--version (string)

Display the version of this tool.

--color (string)

Turn on/off color output.

  • on
  • off
  • auto

--no-sign-request (boolean)

Do not sign requests. Credentials will not be loaded if this argument is provided.

--ca-bundle (string)

The CA certificate bundle to use when verifying SSL certificates. Overrides config/env settings.

--cli-read-timeout (int)

The maximum socket read time in seconds. If the value is set to 0, the socket read will be blocking and not timeout. The default value is 60 seconds.

--cli-connect-timeout (int)

The maximum socket connect time in seconds. If the value is set to 0, the socket connect will be blocking and not timeout. The default value is 60 seconds.

--cli-binary-format (string)

The formatting style to be used for binary blobs. The default format is base64. The base64 format expects binary blobs to be provided as a base64 encoded string. The raw-in-base64-out format preserves compatibility with AWS CLI V1 behavior and binary values must be passed literally. When providing contents from a file that map to a binary blob fileb:// will always be treated as binary and use the file contents directly regardless of the cli-binary-format setting. When using file:// the file contents will need to properly formatted for the configured cli-binary-format.

  • base64
  • raw-in-base64-out

--no-cli-pager (boolean)

Disable cli pager for output.

--cli-auto-prompt (boolean)

Automatically prompt for CLI input parameters.

--no-cli-auto-prompt (boolean)

Disable automatically prompt for CLI input parameters.

--cli-error-format (string)

The formatting style for error output. By default, errors are displayed in enhanced format.

  • legacy
  • json
  • yaml
  • text
  • table
  • enhanced

--help (boolean)

Display help for the command/subcommand.

Examples

Start the app (backend and frontend, as amplify.jsonc says):

$ aws amplifygen3 local run

Start the app with the backend on a chosen gateway port:

$ aws amplifygen3 local run --port 4000

Pull the backend image again and recreate the backend:

$ aws amplifygen3 local run --rebuild