page:guides:asp net core:private file access

Enforce private-file authorization for ASP.NET Core

Summary

Private file access for an ASP.NET Core app on Ample. Verified on ASP.NET Core: a role-to-document access model with negative tests (401, 403) and an authorized private-bucket round-trip (private=ok).
Build and start: dotnet publish -c Release -o out in the builder, then dotnet .dll on the dotnet-10 template with ASPNETCORE_URLS bound to PORT.

Workload

Enforce private-file authorization

Framework

ASP.NET Core

Resource Requirements

Infrastructure Requirements

  1. Compute: Apps run in isolated x86_64 Firecracker microVMs that auto-pause when idle and wake on request; sizes are the priced VM sizes.
  2. Postgres: Managed PostgreSQL 16 runs in its own microVM and is auto-provisioned when an app needs a database and no DATABASE_URL is supplied.
  3. S3-compatible object storage: Buckets are S3-compatible with issued credentials; PutObject and GetObject are verified by canary. Other S3 operations are not verified.

Prerequisites

Limitations

Cost Estimate

Workflow Steps

  1. Build and start: dotnet publish -c Release -o out in the builder, then dotnet .dll on the dotnet-10 template with ASPNETCORE_URLS bound to PORT; the server must bind 0.0.0.0 on PORT.
  2. Create the bucket and pass its credentials: Create it once with ample bucket create, then pass endpoint, region, bucket and keys with --env; use path-style addressing.
  3. Authorize before touching storage: Return 401 for unauthenticated requests and 403 for the wrong role; keep the bucket unpublished and stream objects through the app.
  4. Verify: Fetch the live URL and /p/private-document-library on the example; on failure read the build and runtime logs.

Success Checks

Evidence Summary

Examples

Next Actions