sveltekit-adapter-aws
sveltekit-adapter-aws copied to clipboard
🔌 SveleteKit AWS adapter with multiple architecture
@jill64/sveltekit-adapter-aws
🔌 SveleteKit AWS adapter with multiple architecture
Introduction
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
-
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
See Full Adapter Options
Architecture
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 |
CI/CD Pipeline
GitHub Actions Example
- Setup AWS CLI (Not required in GitHub Actions)
- Setup AWS Credential
- Build Application with
deploy: true
option
CDK Bootstrap
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
// ...
}
Manual Deploy
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
Delete All Resources
cd ./build && npx cdk destroy --all
License
MIT