---
title: "Astro hosting on Edge | Static-first, SSR when needed"
description: "Deploy Astro to Edge: static builds served from S3-compatible storage through a global CDN, a small VM for on-demand routes, and zero egress fees."
url: https://edge.network/solutions/astro
---

For Astro

# Astro sites, served from the edge

Build to dist/, sync it to a bucket and serve it from 988 locations with no origin server. When a route needs to run on demand, add the Node adapter on a small VM.

[Deploy a VM](/console/access/new?product=compute)[Read the CDN guide](/docs/cdn/getting-started)

The setup on this page costs $21.39 a month, with no egress line.

Why Astro on Edge

## Content-first sites deserve a content-first host

Most Astro pages are HTML by the time they ship. Serve them from a bucket and the edge, and only run a server where you really need one.

-   ### Static-first delivery
    
    Build to dist/, sync it to Edge Storage and put the CDN in front. Most pages never touch a server at all.
    
-   ### On-demand routes when you need them
    
    Set prerender = false on the routes that need it and run @astrojs/node on a small VM. Everything else stays static.
    
-   ### <Image /> without the meter
    
    A small external image service points astro:assets at the CDN. Resize, crop and AVIF/WebP from the URL, with no per-image fee.
    
-   ### Cached everywhere, never metered
    
    Every page and \_astro/ asset is cached in 988 locations. A launch-day spike never becomes a bandwidth invoice.
    
-   ### CI-friendly deploys
    
    Build in GitHub Actions, sync the bucket with the Edge CLI, purge the CDN. A few lines of YAML and no lock-in.
    
-   ### SSL, handled
    
    Add your domain and a Let's Encrypt certificate is issued and renewed for you. No certbot, no expiry reminders.
    

Reference architecture

## Prerendered pages in a bucket, islands on Node

Prerendered pages come straight from a bucket. Routes that opt out of prerendering run on the Node adapter. For a fully static site, leave the VM out.

-   [Storage](/storage)
    
    Holds the built dist/ bundle and any uploaded media.
    
-   [CDN](/cdn)
    
    Serves the whole static build worldwide, with zero egress fees.
    
-   [Compute](/compute)
    
    Optional: runs Astro's Node adapter for on-demand routes.
    
-   [Image optimisation](/docs/cdn/image-optimization)
    
    Backs <Image /> through an external image service: resize, crop, AVIF/WebP.
    
-   [DNS](/dns)
    
    Anycast DNS for the apex, www and preview hostnames.
    
-   [Shield](/shield)
    
    Guards newsletter and contact forms without a CAPTCHA bundle.
    
-   [Assist](/assist)
    
    Answers visitor questions from the pages Astro already renders.
    

Deploy

## From astro build to live in five steps

The first three steps are the whole story for a static site. Steps four and five are there when you need them.

1.  01
    
    ### Build and sync to a bucket
    
    The CDN serves index.html for directory paths, so Astro's default directory output works as-is.
    
    shell
    
    ```
    $ npx astro build
    $ edge storage create acme-docs
    $ edge storage sync --delete ./dist acme-docs/
    ```
    
2.  02
    
    ### Serve the bucket through the CDN
    
    Point the domain's CNAME at cdn.edge.network. A certificate is issued within about a minute.
    
    shell
    
    ```
    $ edge cdn create --name acme-docs
    $ edge cdn domains add cdn-7a19f2 \
        --domain docs.acme.dev \
        --origin-type storage \
        --storage-bucket acme-docs \
        --jit-image
    ```
    
3.  03
    
    ### Deploy on every push
    
    Build, sync, purge. The CLI reads EDGE\_API\_KEY from the environment, so a dedicated CI key is all it needs.
    
    .github/workflows/deploy.yml
    
    ```
    on:
      push:
        branches: [main]
    jobs:
      deploy:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v4
          - run: npm ci && npx astro build
          - run: curl -fsSL https://edge.network/install.sh | sh
          - env:
              EDGE_API_KEY: ${{ secrets.EDGE_API_KEY }}
            run: |
              edge storage sync --delete ./dist acme-docs/
              edge cdn purge cdn-7a19f2
    ```
    
4.  04
    
    ### Point <Image /> at the CDN
    
    Register this as image.service.entrypoint in astro.config.mjs. The <Image /> API stays the same; transforms happen at the edge.
    
    src/edge-image.ts
    
    ```
    import type { ExternalImageService } from 'astro'
    
    const service: ExternalImageService = {
      getURL(options) {
        const { src: img } = options
        const src = typeof img === 'string' ? img : img.src
        const q = new URLSearchParams({ format: 'auto', quality: '75' })
        if (options.width) q.set('width', String(options.width))
        if (options.height) q.set('height', String(options.height))
        return `https://docs.acme.dev${src}?${q}`
      },
    }
    
    export default service
    ```
    
5.  05
    
    ### Optional: add on-demand routes
    
    Pages with export const prerender = false run on a VM. Serve dist/client from the bucket and the server entry from the VM.
    
    shell
    
    ```
    $ npx astro add node
    $ edge compute create --name astro-ssr --size s-2vcpu-4gb \
        --image ubuntu-24 --region london --script nodejs
    
    $ npx astro build
    $ rsync -a dist/ root@<vm-ip>:/srv/site/
    $ ssh root@<vm-ip> "pm2 start /srv/site/server/entry.mjs"
    ```
    

Prefer to hand it off? [Give the job to your AI agent](/solutions/agentic-development) or [have our engineers do it](/solutions/expert-services).

What it costs

## Static pages cost pennies. Servers are optional.

The bucket and the CDN do nearly all the work. Add a VM only for the routes that genuinely need one.

-   Fully static? Drop the VM and the bill is $2.15
-   No build minutes, seats or bandwidth tiers
-   Image transforms included with the CDN

[See compute pricing](/compute/pricing)

Estimated monthly bill on Edge

Docs and marketing site, ~1M page views, 8.5M requests, a few on-demand routes

USD

-   Storage$0.1515 GB of build and media: first 5 GB free, 10 GB × $0.015
-   CDN$2.008.5M requests: first 500k free, 8M × $0.25 per million
-   Compute$19.24Standard VM for on-demand routes, 2 vCPU, 4 GiB
-   DNS$0.00Apex, www and preview records
-   Egress$0.00

Total$21.39

FAQ

## Static output, server islands and the rest

Something else? [Ask an engineer](/contact).

Static-only or server-rendered?

Either. A static build needs only a bucket and a CDN deployment. Routes that set prerender = false need the Node adapter on a small VM, and the CDN still serves everything static.

How do I deploy from CI?

Build in your CI, run edge storage sync --delete ./dist <bucket>/, then edge cdn purge. Or use aws s3 sync with --endpoint-url https://storage.edge.network if you'd rather stick with the AWS CLI.

Does Astro's <Image /> component work?

Yes. Register a small external image service that builds CDN URLs with width, height, quality and format parameters. You keep the component API, and transforms happen at the edge.

Do clean URLs and trailing slashes work?

Yes. The CDN serves index.html for directory paths, so /guides/ returns /guides/index.html from the bucket without any rewrite rules.

Can I host a preview per branch?

Yes. Sync each branch build to its own bucket, add a preview hostname to the CDN deployment, and remove both when the pull request closes. The first two buckets are free.

Drop-in services

## Two additions that won't touch your Lighthouse score

-   [
    
    Edge ShieldBot protection`POST /siteverify → score: 94`
    
    Guard newsletter and contact forms with one server-side check. No CAPTCHA bundle on pages you worked hard to keep light.
    
    Free forever, with unlimited widgets. No puzzles for visitors.Explore
    
    ](/shield)
-   [
    
    Edge AssistAI answers`<script src="…/assist.js">`
    
    Content sites are Assist's home ground. It answers from the pages Astro already renders, with one script tag in your base layout.
    
    Free tier: 250 answered questions a monthExplore
    
    ](/assist)

Frontend & full-stack

## Other front ends that cache this well

[All 38 stacks](/solutions/stacks)

-   [Static sitesHugo, Eleventy or Jekyll, straight to the CDN](/solutions/static-sites)
-   [Next.jsSelf-host Next.js without the lock-in](/solutions/nextjs)
-   [NuxtVue-powered SSR on global VMs](/solutions/nuxt)
-   [SvelteKitTiny, fast and Node-friendly](/solutions/sveltekit)

## Put your Astro site on Edge

A bucket, a CDN deployment and a DNS zone. Add a VM only when a route needs one.

[Deploy a VM](/console/access/new?product=compute)[Talk to an engineer](/contact)

Billed hourly from a prepaid balance. Egress is free on every product.
