π SveleteKit AWS adapter with multiple architecture
If you are building a SPA, consider AWS Amplify + adapter-static.
If you want to use always-on servers (not serverless), consider EC2 (ECR) + adapter-node.
-
Install AWS CLI in local machine
-
Install adapter in your SvelteKit project
npm i -D @jill64/sveltekit-adapter-aws
- If using pnpm, additional dependency is required.
pnpm i -D aws-cdk-lib dotenv
// svelte.config.js
import adapter from '@jill64/sveltekit-adapter-aws'
const config = {
// ...
kit: {
adapter: adapter({
name: 'Your Application Name',
deploy: true,
architecture: 'lambda-s3'
// ...
// Other Adapter Options
// ...
})
}
}
export default config
This adapter allows you to choose from multiple architectures depending on your use case.
Name | Response Streaming | Assets Scaling | Low Round Trip | Unlimited SSG | Demo Site (Streaming) | Demo Site (Bufffered) |
---|---|---|---|---|---|---|
lambda-mono | β | β | Link | Link | ||
lambda-s3(Default) | β | β | β | Link | Link | |
edge-bundled | β | β | β | Link | ||
edge-unbundled | β | β | β | Link | Link |
- Setup AWS CLI (Not required in GitHub Actions)
- Setup AWS Credential
- Build Application with
deploy: true
option
The first time the AWS CDK stack is deployed, bootstrap
must be run.
Normally this is handled automatically by the adapter.
However, this requires additional permissions, so you can optionally skip the bootstrap
step.
{
// Adapter Option
skipBootstrap: true
// ...
}
If the automatic deployment option is false, you can deploy the app at any time by running the following command after the app build is complete.
cd ./build && npx cdk deploy
cd ./build && npx cdk destroy --all