Skip to content

Commit

Permalink
Update to SST v3 (#9475)
Browse files Browse the repository at this point in the history
Co-authored-by: Sarah Rainsberger <[email protected]>
  • Loading branch information
jayair and sarah11918 authored Sep 24, 2024
1 parent 3a94caf commit 0b6bb27
Showing 1 changed file with 15 additions and 19 deletions.
34 changes: 15 additions & 19 deletions src/content/docs/en/guides/deploy/sst.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,50 +6,46 @@ i18nReady: true
---
import { Steps } from '@astrojs/starlight/components';

You can deploy an Astro site using [SST](https://sst.dev), an open-source framework for deploying fully serverless applications to AWS with SSG and SSR support.
You can deploy an Astro site to AWS using [SST](https://sst.dev), an open-source framework for deploying modern full-stack applications with SSG and SSR support.

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

## Quickstart

<Steps>
1. Create an astro project.

2. Run `npx create-sst`.
2. Run `npx sst@latest init`.

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`.
4. Once you're ready for deployment you can run `npx sst deploy --stage production`.
</Steps>

You can also watch [a video walkthrough of this process](https://www.youtube.com/watch?v=AFP3ZHxO7Gg) that will guide you through the steps.
You can also read [the full Astro on AWS with SST tutorial](https://sst.dev/docs/start/aws/astro) that will guide you through the steps.

### SST constructs
### SST components

To use any [additional SST constructs](https://docs.sst.dev/), add them to `sst.config.ts`.
To use any [additional SST components](https://sst.dev/docs/), add them to `sst.config.ts`.

```ts {2} {4} title="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,
});
const bucket = new sst.aws.Bucket("MyBucket", {
access: "public",
});
new sst.aws.Astro("MyWeb", {
link: [bucket],
});
```

And then access them in your `.astro` file.

```astro
---
import { Bucket } from "sst/node/bucket"
console.log(Bucket.public.bucketName)
import { Resource } from "sst"
console.log(Resource.MyBucket.name)
---
```

Consult the [SST docs on Resource Binding](https://docs.sst.dev/resource-binding) to learn more.
Consult the [SST docs on linking resources](https://sst.dev/docs/linking) to learn more.

If you have any questions, you can [ask in the SST Discord](https://discord.gg/sst).

0 comments on commit 0b6bb27

Please sign in to comment.