Skip to content

Astro

Source: src/AWS/Website/Astro.ts

Deploy an Astro application to AWS: the server bundle on a streaming Lambda Function URL, static assets (prerendered pages included) in S3, and a CloudFront distribution whose edge router serves uploaded files from S3 and forwards everything else to the server.

The build runs through @alchemy.run/frontend-frameworks/astro with the @alchemy.run/frontend-frameworks/astro/aws deploy target (a wrangler-free AWS Lambda adapter is injected — your astro.config.* must not declare one) — the package must be installed in your project.

Pages render on demand by default (output: "server"); pages that export const prerender = true are prerendered at build time and served from S3. With astro: { output: "static" } every page is prerendered and the deploy is assets-only — no Lambda.

Basic Astro App

const site = yield* AWS.Website.Astro("Web", {
rootDir: "./app",
});

Custom Domain

const site = yield* AWS.Website.Astro("Web", {
rootDir: "./app",
domain: {
name: "app.example.com",
hostedZoneId: zone.hostedZoneId,
},
});
const site = yield* AWS.Website.Astro("Docs", {
rootDir: "./docs",
astro: { output: "static" },
errorPage: "404.html",
});
const site = yield* AWS.Website.Astro("Web", {
rootDir: "./app",
server: {
memorySize: 2048,
environment: {
API_BASE: api.url,
},
},
});