This project contains a SvelteKit adapter to deploy SvelteKit to AWS using AWS-CDK.
npm create svelte@latest my-app
cd my-app
npm install
npm install -D sveltekit-adapter-aws
svelte.config.js
import { adapter } from 'sveltekit-adapter-aws';
import preprocess from 'svelte-preprocess';
export default {
preprocess: preprocess(),
kit: {
adapter: adapter({
autoDeploy: true,
}),
},
};
export interface AWSAdapterProps {
cdkProjectPath?: string; // AWS-CDK App file path for AWS-CDK custom deployment applications (e.g. ${process.cwd()}/deploy.js)
artifactPath?: string; // Build output directory (default: build)
autoDeploy?: boolean; // Should automatically deploy in SvelteKit build step (default: false)
stackName?: string; // AWS-CDK CloudFormation Stackname (default: AWSAdapterStack-Default)
esbuildOptions?: any; // Override or extend default esbuild options. Supports `external` (default `['node:*']`), `format` (default `cjs`), `target` (default `node16`), `banner` (default `{}`).
FQDN?: string; // Full qualified domain name of CloudFront deployment (e.g. demo.example.com)
MEMORY_SIZE?: number; // Memory size of SSR lambda in MB (default 128 MB)
LOG_RETENTION_DAYS?: number; // Log retention in days of SSR lambda (default 7 days)
zoneName?: string; // The name of the hosted zone in Route 53 (defaults to the TLD from the FQDN)
}