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.

Your astro.config.* is the home for Astro configuration and loads natively; the astro prop is a deploy-time override bag merged OVER the file for values that vary per stage or derive from other resources’ Outputs. config points at an alternate config file (relative to rootDir).

Basic Astro App

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

Per-stage site URL override

const site = yield* AWS.Website.Astro("Blog", {
rootDir: "./blog",
astro: { site: "https://blog.example.com" },
});

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",
memorySize: 2048,
env: {
API_BASE: api.url,
},
});