# Deliver public assets through CDN for Echo

## Summary
Cdn assets for a Echo app on Ample. Verified on Echo: a versioned, immutable-cached asset uploaded to a published bucket and served from the CDN URL. Build and start: `CGO_ENABLED=0 go build -o app ./...` then `./app` on the ubuntu-24.04 template (go.sum committed for a reproducible build).

## Representative Queries
- Deliver public assets through CDN for Echo
- Where can I host Deliver public assets through CDN built with Echo?
- I need a public-origin configuration, versioned asset build and observable cache behavior.

## Resource Requirements
- primitive:compute
- primitive:cdn

## Infrastructure Requirements
- **Compute**: Apps run in isolated x86_64 Firecracker microVMs that auto-pause when idle and wake on request; sizes are the priced VM sizes.
- **CDN**: The CDN host serves objects from published buckets. It does not front app compute and is not a cache or key-value store.

## Framework
Echo

## Workload
Deliver public assets through CDN

## Release Status
Published

## Support Status
Verified

## Execution Status
Ready

## Prerequisites
1. A Echo project (`CGO_ENABLED=0 go build -o app ./...` then `./app` on the ubuntu-24.04 template (go.sum committed for a reproducible build))
2. A bucket from `ample bucket create` with credentials passed as encrypted S3_* environment variables
3. An Ample account token with servers:write, buckets:read

## Tested Configuration
- **Template**: ubuntu-24.04
- **Runtime**: go
- **Size**: s-1vcpu-1gb
- **Build Command**: `CGO_ENABLED=0 go build -o app ./...`
- **Start Command**: `./app`

## Workflow Steps
1. **Build and start**: `CGO_ENABLED=0 go build -o app ./...` then `./app` on the ubuntu-24.04 template (go.sum committed for a reproducible build); the server must bind 0.0.0.0 on PORT.
2. **Publish a bucket for public assets**: Publish only the asset bucket; upload versioned keys with an immutable Cache-Control header and build URLs from its public URL. `ample bucket publish`
3. **Verify**: Fetch the live URL and /p/versioned-static-assets on the example; on failure read the build and runtime logs. `ample logs --kind build`

## Examples
- **Title**: Echo pattern fixture  
  **Description**: Verified CDN assets on Echo.  
  **Source Reference**: tests/deploy-canaries/echo-patterns

## Success Checks
- **Description**: App responds on its public URL  
  **Kind**: http_get  
  **Path**: /  
  **Expect**: ample canary echo patterns  
- **Description**: Versioned-static-assets check from the example  
  **Kind**: http_get  
  **Path**: /p/versioned-static-assets  
  **Expect**: see the pattern fixture checks

## Limitations
- Verified on the ubuntu-24.04 template at s-1vcpu-1gb; other sizes and Echo major versions are not verified.  
- Region, compliance attestations and request-duration limits are unknown and not claimed.
- The CDN serves published-bucket objects only; cache rules, purge and TTL control are not verified.

## Cost Estimate
- **Currency**: USD  
- **Monthly Amount**: 5.0  
- **Basis**: Size prices from pricing.toml (loaded by the API) at build revision 1ac5595375130d45290090e82ed0f554ccd45405-dirty
- **Components**:  
  - **Name**: app server  
    **Size**: s-1vcpu-1gb  
    **Quantity**: 1.0  
    **Monthly Amount**: 5.0  
- **Note**: Always-on monthly price of the tested sizes; apps auto-pause when idle. Buckets are allocation-priced per quota and not included.

## Evidence Summary
- **Kind**: canary_run  
- **Summary**: Echo pattern fixture deployed on Ample (CGO_ENABLED=0 go build -o app ./... then ./app on the ubuntu-24.04 template (go.sum committed for a reproducible build)); for this guide: a versioned, immutable-cached asset uploaded to a published bucket and served from the CDN URL.  
- **Observed At**: 2026-09-21T02:34:39Z  
- **Implementation Revision**: 1d28ae0-dirty (CLI 0.1.21)  
- **Expires At**: 2027-03-20T02:34:39Z

## Next Actions
- **Action Id**: browse-catalog  
  **Label**: Browse the catalog index  
  **Operation Id**: catalog_index  
  **Method**: GET  
  **Relative Path**: /v1/catalog  
  **Origin**: api
- **Action Id**: search-recipes  
  **Label**: Search published recipes by intent, stack and constraints  
  **Operation Id**: search_recipes  
  **Method**: POST  
  **Relative Path**: /v1/catalog/search  
- **Action Id**: plan:page:guides:echo:cdn-assets  
  **Label**: Prepare a side-effect-free deployment plan for an authorized project  
  **Operation Id**: plan_deployment  
  **Method**: POST  
  **Relative Path**: /v1/catalog/plan  
- **Action Id**: auth-setup  
  **Label**: Read the existing agent authentication setup  
  **Operation Id**: existing_auth_setup  
  **Method**: GET  
  **Relative Path**: /mcp/setup  
- **Action Id**: browse:stack:framework-echo  
  **Label**: Browse Echo  
  **Operation Id**: browse_node  
  **Method**: GET  
  **Relative Path**: /v1/catalog/nodes/stack%3Aframework-echo  
- **Action Id**: browse:intent:add-cdn  
  **Label**: Browse Add CDN  
  **Operation Id**: browse_node  
  **Method**: GET  
  **Relative Path**: /v1/catalog/nodes/intent%3Aadd-cdn  
- **Action Id**: browse:pattern:versioned-static-assets  
  **Label**: Browse Versioned static assets  
  **Operation Id**: browse_node  
  **Method**: GET  
  **Relative Path**: /v1/catalog/nodes/pattern%3Aversioned-static-assets
