# Deploying to AWS

> Source: https://agilitycms.com/docs/sveltekit/deploying-to-aws

AWS gives you several ways to run the [SvelteKit starter](https://github.com/agility/sveltekit-starter). Pick based on how much infrastructure you want to own. In every case, the starter's config comes from `$env/static/private` and is **inlined at build time** — set the Agility variables wherever the build runs:

| Variable | Value |
| --- | --- |
| `AGILITY_GUID` | Your instance GUID (*Settings → API Keys*) |
| `AGILITY_API_FETCH_KEY` | Fetch (live) API key |
| `AGILITY_API_PREVIEW_KEY` | Preview API key |
| `AGILITY_SITEMAP` | e.g. `website` |
| `AGILITY_LOCALES` | e.g. `en-us` |

## Option A — AWS Amplify Hosting (managed)

Amplify Hosting supports SvelteKit SSR deployments from a Git repo:

1. In the Amplify console, **New app → Host web app**, connect the repo.
2. Confirm the build command (`npm run build`) and add the environment variables above.
3. Deploy. **Rebuild on publish:** create an *Incoming webhook* in Amplify (App settings → Build settings) and point an Agility publish webhook at it.

## Option B — SST (serverless, IaC)

[SST](https://sst.dev) deploys SvelteKit to Lambda + CloudFront with its `SvelteKitSite` construct (`svelte-kit-sst` works with the starter's `adapter-auto`). Best when the site is part of a larger AWS stack you define as code. Rebuilds are `sst deploy` runs — trigger your CI from an Agility publish webhook.

## Option C — adapter-node on your own compute

Run SvelteKit as a plain Node server on App Runner, Elastic Beanstalk, ECS, or EC2:

```bash
npm i -D @sveltejs/adapter-node@5
```

> The starter uses SvelteKit 2. `@sveltejs/adapter-node` 6 and later require SvelteKit 3, so install version 5 until you upgrade the starter to SvelteKit 3.

```js
// svelte.config.js
import adapter from '@sveltejs/adapter-node';
export default { kit: { adapter: adapter() } };
```

```bash
npm run build
node build   # serves on PORT (default 3000)
```

Put CloudFront in front for caching/TLS. Rebuild-on-publish is your CI pipeline re-running on an Agility webhook.

## Which one?

| You want | Choose |
| --- | --- |
| Managed Git-push deploys | **Amplify Hosting** |
| Serverless + infrastructure-as-code | **SST** |
| Full control / existing containers | **adapter-node** on App Runner/ECS/EC2 |

> The starter prerenders every page at build time (see [Routing & Sitemaps](/docs/sveltekit/routing-sitemaps)), so published content appears after the next build — wire Agility's publish webhook into whichever build trigger your option uses. The preview toggle is for local dev; production serves **published** content.

---

Index of every docs page: https://agilitycms.com/docs/llms.txt
