تخطَّ إلى المحتوى

Deploy your Astro Site to AWS with SST

هذا المحتوى غير متوفر بلغتك بعد.

You can deploy an Astro site using SST, an open-source framework for deploying fully serverless applications to AWS with SSG and SSR support.

You can also use any additional SST constructs like Cron Jobs, Buckets, Queues, etc while maintaining type-safety.

  1. Create an astro project.

  2. Run npx create-sst.

  3. It should detect that you are using Astro and ask you to confirm.

  4. Once you’re ready for deployment you can run npx sst deploy --stage=production.

You can also watch a video walkthrough of this process that will guide you through the steps.

To use any additional SST constructs, add them to sst.config.ts.

sst.config.ts
app.stack(function Site(ctx) {
const bucket = new Bucket(ctx.stack, "public");
const site = new AstroSite(ctx.stack, "site", {
bind: [bucket],
});
ctx.stack.addOutputs({
url: site.url,
});
});

And then access them in your .astro file.

---
import { Bucket } from "sst/node/bucket"
console.log(Bucket.public.bucketName)
---

Consult the SST docs on Resource Binding to learn more.

If you have any questions, you can ask in the SST Discord.

المزيد من أدلة النشر

ساهم

بماذا تفكّر؟

المجتمع