Skip to content

docs: add self-hosting documentation - #8605

Merged
osama-rizk merged 6 commits into
mainfrom
docs/self-hosting
Sep 11, 2026
Merged

osama-rizk merged 6 commits into
mainfrom
docs/self-hosting

Conversation

@adrianjoshua-strutt

@adrianjoshua-strutt adrianjoshua-strutt commented Jun 2, 2026 •

Copy link
Copy Markdown
Member

Preview: https://d2a8cehsb9j05d.cloudfront.net

Adds documentation for the self-managed hosting feature (defineHosting, definePipeline, ampx deploy).

Pages added

  • /deploy-and-host/self-hosting/ — Overview
  • /deploy-and-host/self-hosting/getting-started/ — Install and first deploy
  • /deploy-and-host/self-hosting/define-hosting/ — Configure hosting (domains, WAF, compute, CDK escape hatches)
  • /deploy-and-host/self-hosting/define-pipeline/ — Set up CI/CD pipeline
  • /deploy-and-host/self-hosting/external-pipelines/ — GitHub Actions, GitLab CI

Navigation

Updated src/directory/directory.mjs to add the self-hosting section under deploy-and-host.

Related: aws-amplify/amplify-backend#3211

@adrianjoshua-strutt
adrianjoshua-strutt requested review from a team as code owners June 2, 2026 13:18
@github-actions github-actions Bot added the redirects-needed Redirects need to be created for deleted pages label Jun 2, 2026
@mergify

mergify Bot commented Jun 2, 2026

Copy link
Copy Markdown

@adrianjoshua-strutt, since a file was deleted from the src/pages and/or src/fragments directories, redirects might need to be set up so these previous pages do not 404. If redirects are needed, please answer these questions for each redirect that is needed:

  • What is the source address of the redirect? (Where are you trying to redirect from?)

  • What is the target address of the redirect? (Where are you trying to redirect to?)

  • Type of redirect? 301 - permanent redirect or 302 - temporary redirect? (More info on Amplify Hosting redirects here: https://docs.aws.amazon.com/amplify/latest/userguide/redirects.html)

@adrianjoshua-strutt

Copy link
Copy Markdown
Member Author

Redirects are already configured in redirects.json in this PR. All are 301 permanent redirects:

Source Target Type
/<platform>/deploy-and-host/hosting/ /<platform>/deploy-and-host/amplify-hosting/ 301
/<platform>/deploy-and-host/hosting/<*> /<platform>/deploy-and-host/amplify-hosting/<*> 301
/<platform>/deploy-and-host/fullstack-branching/ /<platform>/deploy-and-host/amplify-hosting/ 301
/<platform>/deploy-and-host/fullstack-branching/branch-deployments/ /<platform>/deploy-and-host/amplify-hosting/branch-deployments/ 301
/<platform>/deploy-and-host/fullstack-branching/pr-previews/ /<platform>/deploy-and-host/amplify-hosting/pr-previews/ 301
/<platform>/deploy-and-host/fullstack-branching/secrets-and-vars/ /<platform>/deploy-and-host/amplify-hosting/secrets-and-vars/ 301
/<platform>/deploy-and-host/fullstack-branching/share-resources/ /<platform>/deploy-and-host/amplify-hosting/share-resources/ 301
/<platform>/deploy-and-host/fullstack-branching/custom-pipelines/ /<platform>/deploy-and-host/amplify-hosting/custom-pipelines/ 301
/<platform>/deploy-and-host/fullstack-branching/cross-account-deployments/ /<platform>/deploy-and-host/amplify-hosting/cross-account-deployments/ 301
/<platform>/deploy-and-host/fullstack-branching/mono-and-multi-repos/ /<platform>/deploy-and-host/amplify-hosting/mono-and-multi-repos/ 301
/<platform>/deploy-and-host/fullstack-branching/monorepos/ /<platform>/deploy-and-host/amplify-hosting/monorepos/ 301

All pages moved from hosting/ and fullstack-branching/ into amplify-hosting/ as part of a nav restructure. The ValidateRedirects CI check passes locally.

Comment thread src/pages/[platform]/deploy-and-host/self-hosting/getting-started/index.mdx Outdated
Comment thread src/pages/[platform]/deploy-and-host/self-hosting/index.mdx Outdated
osama-rizk
osama-rizk previously approved these changes Jun 4, 2026
@adrianjoshua-strutt
adrianjoshua-strutt marked this pull request as draft June 4, 2026 10:07
@adrianjoshua-strutt
adrianjoshua-strutt marked this pull request as ready for review June 26, 2026 15:55
bobbor
bobbor previously approved these changes Jul 2, 2026
Adds documentation for the self-managed hosting feature (defineHosting, definePipeline, ampx deploy), restructures the deploy-and-host section into Amplify Hosting and Self-managed hosting, and adds preview labeling.

RFC: aws-amplify/amplify-backend#3211
bobbor
bobbor previously approved these changes Jul 7, 2026
Corrections to match the shipped @aws-amplify/hosting 1.0.0 API:
- compute: remove nonexistent 'runtime' option
- cdn: replace nonexistent cachePolicy{defaultTtl,maxTtl} with ssrDefaultTtl (Duration); fix geoRestriction to { type, countries }
- storage: encryption 'S3' -> 'S3_MANAGED'
- pipeline: bakeTime is a Duration (was a number); computeType is ComputeType enum (was a string); fix getStageConfig() usage (undefined guard + .config nesting)
- pipeline: synth step synthesizes (cdk synth) instead of the invalid 'ampx deploy --frontend --backend' combo; 'ampx deploy --pipeline' cannot take --identifier
- frameworks: customAdapter is a FrameworkAdapterFn (function), not an object; add SvelteKit
- external pipelines: add --yes to all CI deploy commands (the command prompts otherwise) and document the flag

Content:
- add Secrets and environment variables page and wire nav + cross-links
- document default-on monitoring and skewProtection options

Release framing:
- remove preview banners and 'not for production' language; drop stale 'install the preview via RFC' instruction (ships as 1.0.0 on npm)

- cspell: add 'maxage', 'prerendered'

@bobbor bobbor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left some small comments that require clarification

name: 'production',
requireApproval: true,
bakeTime: 30,
bakeTime: Duration.minutes(30),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep this a number pls.
similar to all other configurations where CDK durations are alternatives.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked into this before changing it and I don't think a number compiles today. In the published @aws-blocks/pipeline@0.2.1 (what @aws-amplify/hosting@1.0.0 depends on), PipelineStageConfig.bakeTime is typed as cdk.Duration only — not Duration | number:

readonly bakeTime?: cdk.Duration;

and the upstream package's own JSDoc example uses bakeTime: Duration.minutes(30). The Duration | number convention does apply elsewhere (e.g. compute.timeout), just not to bakeTime yet — so bakeTime: 30 would be a type error for consumers on the released version.

Happy to switch it to a number if you'd prefer the docs to lead the API — but that'd need bakeTime to accept number in a released @aws-blocks/pipeline. Is that shipped/planned? If you point me at the version I'll update the example (and we can note the minimum version).

const customAdapter: FrameworkAdapterFn = async (projectDir) => {
// Build your project, then return a DeployManifest that points the
// hosting construct at the built static assets and server handler.
return buildMyFrameworkManifest(projectDir);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

by removing the example (serverEntry, buildCommand etc.) it is no longer clear what the custom adapter should do.

Also, is an (async) adapter function the only way to provide a custom adapter?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call — restored a concrete example (808d7a9). To answer the question directly: an adapter function is the only way to provide a custom adapter, and it's a single form — a synchronous FrameworkAdapterFn, i.e. (projectDir: string) => DeployManifest (from @aws-blocks/hosting; there's no object form, and it isn't async). The example now returns a concrete static-only DeployManifest (staticAssets + empty compute/routes) so it's clear what the adapter must produce, with a note that SSR frameworks populate compute and routes.

osama-rizk
osama-rizk previously approved these changes Sep 10, 2026
…Fn with a concrete DeployManifest example

Addresses review: the previous change removed the example without showing what
the adapter must return. A custom adapter is the only way to add an unsupported
framework and takes a single form — a synchronous (projectDir) => DeployManifest.
Show a concrete static-only manifest (staticAssets/compute/routes) and note SSR
uses compute + routes.
Framework is auto-detected, and the supported-framework list plus the override
are already documented on the Supported frameworks and Configure hosting pages.
Replace the inline list with links (addresses review feedback).
**Static / React SPA / Vite / CRA** — Fallback when no server framework is detected. Your app is built as static files and served directly from Amazon S3 through Amazon CloudFront with no server compute required.

**Custom frameworks** — If your framework is not auto-detected, pass a `customAdapter` function to `defineHosting()`. An adapter is a `FrameworkAdapterFn`: it receives the project directory, runs your build, and returns a `DeployManifest` describing the static assets and server handler to deploy.
**Custom frameworks** — If your framework is not auto-detected, provide a `customAdapter`. This is the only way to add an unsupported framework, and it takes a single form: a synchronous `FrameworkAdapterFn` — `(projectDir: string) => DeployManifest`. The function inspects/builds the project at `projectDir` and returns a `DeployManifest` that tells the hosting construct where the built static assets live, which compute functions to create for SSR, and how to route requests.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is a DeployManifest?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a definition (bbf725f). A DeployManifest is the framework-agnostic contract between an adapter and the hosting construct — a plain JSON object describing what to deploy, so the construct needs no framework-specific knowledge. Top-level fields: version, staticAssets ({ directory, immutablePaths?, noCachePaths?, spaFallback? }), compute (named SSR functions; empty for static), routes (path → compute/static), plus optional cache (ISR), imageOptimization, middleware, and redirects/rewrites/headers. Every built-in adapter produces one; the full schema is in @aws-amplify/hosting's DeployManifest type.

Addresses review question 'What is a DeployManifest?' — add a short explanation
(framework-agnostic adapter↔construct contract) and its top-level fields before
the example.

A **`DeployManifest`** is the framework-agnostic contract between an adapter and the hosting construct: a plain JSON object describing what to deploy, so the construct never needs framework-specific knowledge. Every built-in adapter produces one. Its top-level fields:

- `version` — manifest schema version (currently `1`).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The DeployManifest is described as "a plain JSON object".
But a "schema version" implies a schema. Do we have one?

So which one is it?


compare to amplify_outputs.json schema

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch — that wording was contradictory. It's a TypeScript type, not a JSON-Schema-backed document, so I've fixed the text (036d53f).

To answer directly: there is no separate published JSON Schema for DeployManifest (nothing equivalent to the amplify_outputs.json schema you linked). It's a TS type exported from @aws-amplify/hosting, and the adapter returns it in-process at synth time — you never author or validate a .json file. The type itself is the contract, enforced by TypeScript.

The version: 1 field is a literal format-version marker so the manifest shape can evolve compatibly across releases; it isn't a reference to an external schema. So: it's a JSON-serializable object described by a TypeScript type — not a schema-file-validated document.

…chema doc

Addresses review: 'plain JSON object' + 'schema version' was contradictory.
Clarify it's a TypeScript type (the type is the schema), returned in-process by
the adapter; no separate published JSON Schema, and version is a format-evolution
marker.
@osama-rizk
osama-rizk merged commit 9ab40dd into main Sep 11, 2026
13 checks passed
@osama-rizk
osama-rizk deleted the docs/self-hosting branch September 11, 2026 14:43
@mergify

mergify Bot commented Sep 11, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

osama-rizk added a commit that referenced this pull request Sep 29, 2026
* docs(self-hosting): restore preview banner

Put back the preview callout and the '(Preview)' section title that were
removed during review of #8605. ampx deploy still ships as a preview release,
so the docs should say so. Also adds the banner to the secrets and environment
variables page, which was added after the banner was removed.

* docs(self-hosting): point preview banner at GitHub issues instead of the closed RFC

* docs(self-hosting): address review — shared PreviewBanner, info style, reconcile --yes

- Replace the seven inline banner copies with a shared <PreviewBanner /> component
  registered in mdx-components (like Callout), so it can't drift and removal at GA
  is a single change. Drops the unused PREVIEW-BANNER marker comments.
- Use an info callout (matching the AWS Blocks preview notice) so warning styling
  stays reserved for actionable notes like the CDK bootstrap prerequisite.
- Drop '(Preview)' from the section title; the banner carries the status.
- External pipelines: describe what the ampx deploy prompt actually says, note that
  --yes accepts it without changing preview status, and rename example identifiers
  from 'production' to 'my-app' (also in getting started).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

redirects-needed Redirects need to be created for deleted pages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants