Generated banner for AWS Blocks
Generated logo for AWS Blocks

AWS Blocks

AWSOfficialPublished by AWS

  • Skill
  • Tool integration
  • Cloud and DevOps
  • Apache-2.0
  • No issues found

From the author

Guides building full-stack applications with AWS Blocks — an Infrastructure-from-Code framework. Applies when creating APIs, selecting Building Blocks (KVStore, DistributedTable, Database, AuthBasic, AuthCognito, Realtime, AsyncJob, FileBucket, etc.), running local development, or deploying AWS Blocks applications. Also covers AWS Blocks topics with validated, version-specific patterns that prevent common mistakes. Triggers when user mentions AWS Blocks; project has aws-blocks/ directory; code imports @aws-blocks packages.
— the description by AWS

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

AWS Blocks is an Infrastructure-from-Code framework that simplifies backend development by bundling CDK, SDK, and local mocks into unified Building Blocks. It enables developers to define backend resources within an aws-blocks/ directory, providing typed frontend integration and local development capabilities without requiring AWS credentials. The framework supports various services including storage, authentication, real-time communication, and background jobs, while enforcing security best practices through least-privilege resource management.

What it does

  • Provides a unified API for AWS services using pre-configured Building Blocks.
  • Enables local development and testing of backend infrastructure without AWS credentials.
  • Supports scaffolding new projects or integrating with existing ones, including Amplify Gen 2.
  • Offers typed frontend integration to eliminate the need for manual client generation.
  • Includes security guidance for authentication, secret management, and IAM policy configuration.
  • Facilitates deployment of ephemeral sandbox environments and long-lived production stacks.

When to use it

  • When building full-stack applications that require integrated AWS backend services.
  • When you need a local development environment that mirrors cloud infrastructure.
  • When you want to manage backend infrastructure as code within a dedicated workspace.
  • When implementing authentication, storage, or real-time features in a type-safe manner.
  • When deploying applications that require least-privilege IAM configurations.

Advantages

  • Reduces boilerplate by bundling CDK and SDK logic into reusable blocks.
  • Improves developer productivity with local mocks that persist data.
  • Ensures type safety between the backend API and frontend code.
  • Simplifies security by providing built-in least-privilege resource scoping.
  • Supports rapid iteration through ephemeral sandbox deployments.

Usage examples

“How do I start a new AWS Blocks project?”
You can use the CLI command 'npx @aws-blocks/create-blocks-app my-app' to scaffold a new project with the default template.
“How do I secure an API method in AWS Blocks?”
You should use 'await auth.requireAuth(context)' within your method to ensure it is protected, as methods are unauthenticated by default.
“Can I use AWS Blocks with an existing Amplify project?”
Yes, running 'npx @aws-blocks/create-blocks-app .' in your project root will detect 'amplify/backend.ts' and integrate AWS Blocks automatically.

Install

  1. Download the skill as a ZIP:

    https://autogineer.com/agent-skills/aws/aws-blocks/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip aws-blocks.zip -d .agents/skills

Documentation by AWS

AWS Blocks Application Development

Package naming: All packages are published under the @aws-blocks scope (e.g., @aws-blocks/core, @aws-blocks/blocks, @aws-blocks/bb-kv-store).

Overview

AWS Blocks is an Infrastructure-from-Code framework where Building Blocks bundle CDK, SDK, and local mocks into a single API. It provides 18+ Building Blocks covering storage, authentication, real-time communication, background jobs, file management, AI/search, email, and observability — all working locally without AWS credentials.

Key characteristics:

  • One aws-blocks/ directory defines the entire backend

  • Frontend imports are fully typed — no client generation needed

  • All Building Blocks work locally without AWS (mocks persist to .bb-data/)

  • Deploy ephemeral, individual testing environments with npm run sandbox and long-lived environments with npm run deploy using least-privilege credentials

Scaffolding a New Project

npx @aws-blocks/create-blocks-app my-app
cd my-app
To add AWS Blocks to an existing project:
npx @aws-blocks/create-blocks-app .

This detects the existing project and adds an aws-blocks/ workspace alongside your code.

To add AWS Blocks to an Amplify Gen 2 project:
npx @aws-blocks/create-blocks-app .

When the CLI detects amplify/backend.ts, it automatically integrates AWS Blocks with your Amplify backend.

With a specific template:
npx @aws-blocks/create-blocks-app my-app --template demo
cd my-app
Available Templates
TemplateDescription
defaultVite + lit-html starter app with basic authentication, data persistence, and realtime to help demonstrate basic app architecture and patterns (used when --template is omitted)
bareVite + lit-html starter with a single "hello world" API method and a bare frontend
reactReact + Vite starter with a single API endpoint and typed React frontend
backendBackend-only — no frontend, just the AWS Blocks API with a single endpoint
demoTodo app with AuthBasic, KVStore, DistributedTable, Zod schemas, indexes, and auth-protected CRUD
auth-cognitoFull AuthCognito passwordless email-OTP with roles, device management, and Authenticator UI
nextjsNext.js + React starter with AWS Blocks backend integration (SSR + Server Components)

Development Workflow

After scaffolding, refer to node_modules/@aws-blocks/blocks/README.md for the complete development workflow including:

  • Core concepts (Architecture, Building Block selection)

  • Project structure and Scope organization

  • Error handling patterns

  • Schema validation

  • Local development

  • Best practices and common mistakes

  • Deployment IAM role setup and security guidance

When implementing a specific Building Block, read its package README for the detailed API reference (e.g., node_modules/@aws-blocks/bb-kv-store/README.md). These are the authoritative docs for your installed version.

Security Considerations

  • Use await auth.requireAuth(context) in every method that shouldn't be public — ApiNamespace methods are unauthenticated by default

  • Use new AppSetting(scope, id, { secret: true }) for API keys and credentials — never hardcode or use .env files

  • Always attach a schema to KVStore/AppSetting that accepts user data — the RPC layer validates structure but not business logic

  • Do not add broad * IAM policies — each Building Block already grants least-privilege scoped to its own resources

  • Never change blockPublicAccess on FileBucket — serve public files through CloudFront instead

  • Configure CORS_ALLOWED_ORIGINS explicitly for production — avoid wildcards

  • For cross-domain deployments, pass crossDomain: true to auth constructors (enables SameSite=None; Secure; Partitioned)

  • Enable monitoring: { enabled: true, snsTopicArn: '...' } on Hosting for production alerts

  • Add WAF and API Gateway throttling via CDK for public-facing apps — not included by default

  • Logger provides serialization safety (circular refs, type coercion) but does NOT redact sensitive content — never pass raw credentials, tokens, or secrets to Logger methods; sanitize context objects before logging

Files

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Needs: Needs an API key, Needs Node.js

Security

No issues found by our static scan· No issues found

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Published by
AWS
Publisher
AWS (Official)
Source
aws/agent-toolkit-for-aws · skills/core-skills/aws-blocks · commit 0a218f8
Licence
Apache License 2.0 (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • NOTICE (added by AutoGineer from NOTICE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced
Also distributed in
aws/agent-toolkit-for-aws

AutoGineer is not affiliated with or endorsed by AWS or AWS.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download aws-blocks.zip