Getting Started
What is Astro AWS
Astro AWS is an Astro SSR adapter and constructs for deploying your Astro application to AWS.
IMPORTANT NOTE: These packages only provide the bare minimum AWS CDK configuration to get your application running. Everything that does not need to be configured uses the default values AWS provides.
Start your first Astro project
Create a new Astro project using the create-astro
CLI then add the Astro AWS adapter.
Using NPM
npm create astro@latestnpx astro add @astro-aws/adapter
Using Yarn
yarn create astro@latestyarn astro add @astro-aws/adapter
Using PNPM
pnpm create astro@latestpnpm astro add @astro-aws/adapter
Build your Astro project
### Using NPMnpm run build
# Using Yarnyarn build
# Using PNPMpnpm run build
Start your first AWS CDK project
Create a new AWS CDK project using the CDK cli.
npm i -g aws-cdk
mkdir my-cdk-projectcd my-cdk-project
cdk init app --language typescript
Add the @astro-aws/constructs
package
# Using NPMnpm i @astro-aws/constructs
# Using Yarnyarn add @astro-aws/constructs
# Using PNPMpnpm i @astro-aws/constructs
Modify lib/hello-cdk-stack.ts
to contain the following
import { Stack } from "aws-cdk-lib/core"import type { StackProps } from "aws-cdk-lib/core"import { AstroAWS } from "@astro-aws/constructs"
export interface HelloCdkStackProps extends StackProps {}
export class HelloCdkStack extends Stack { public constructor(scope: Construct, id: string, props: HelloCdkStackProps) { super(scope, id, props)
new AstroAWS(this, "AstroAWS", { websiteDir: "../my-astro-project", }) }}
Deploy your cdk project
cdk deploy