Getting Started
What is Astro AWS
Section titled “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
Section titled “Start your first Astro project”Create a new Astro project using the create-astro CLI then add the Astro AWS adapter.
Using NPM
Section titled “Using NPM”npm create astro@latestnpx astro add @astro-aws/adapterUsing Yarn
Section titled “Using Yarn”yarn create astro@latestyarn astro add @astro-aws/adapterUsing PNPM
Section titled “Using PNPM”pnpm create astro@latestpnpm astro add @astro-aws/adapterBuild your Astro project
Section titled “Build your Astro project”### Using NPMnpm run build
# Using Yarnyarn build
# Using PNPMpnpm run buildStart your first AWS CDK project
Section titled “Start your first AWS CDK project”Create a new AWS CDK project using the CDK cli.
Section titled “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 typescriptAdd the @astro-aws/constructs package
Section titled “Add the @astro-aws/constructs package”# Using NPMnpm i @astro-aws/constructs
# Using Yarnyarn add @astro-aws/constructs
# Using PNPMpnpm i @astro-aws/constructsModify lib/hello-cdk-stack.ts to contain the following
Section titled “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
Section titled “Deploy your cdk project”cdk deploy