Skip to main content
skill CX Codex

aws-cloudformation-dynamodb — Claude Code skill: DynamoDB templates

aws-cloudformation-dynamodb — a Claude skill that supplies CloudFormation patterns for DynamoDB tables: keys, indexes, billing modes, TTL and streams. Handy when infrastructure lives in code.

MIT ★ 372 updated 2026-09-10

Install into Claude Code · Plugin marketplace All methods and platforms ↓
/plugin marketplace add giuseppe-trisciuoglio/developer-kit
/plugin install developer-kit-aws@developer-kit
Open on GitHub

What aws-cloudformation-dynamodb does

The skill lays out DynamoDB tables as CloudFormation templates: a partition key with an optional sort key, GSI and LSI, billing mode PAY_PER_REQUEST or PROVISIONED, KMS encryption, TTL, streams and point-in-time recovery. A numbered workflow runs from template parameters and keys through deployment, then tells you to read stack events when a rollback hits.

Ready YAML snippets cover an on-demand table, a table with a global secondary index, a session table with TTL, and an AWS::ApplicationAutoScaling::ScalableTarget for provisioned capacity. Deeper material sits in references/complete-examples.md and references/advanced-configuration.md; the second one handles Parameters, Mappings, Conditions and cross-stack outputs. The skill may only call Read, Write and Bash.

Two constraints are worth remembering. Streams can be switched on only while a table is created, so a running table cannot gain them through a template update. The TTL attribute has to be of type Number; with a String attribute nothing expires.

What it helps with

  • Write a DynamoDB table into a CloudFormation template
  • Add a GSI for a second access pattern
  • Wire Application Auto Scaling to provisioned capacity
  • Turn on TTL for a session table
  • Trace stack events after a ROLLBACK

Example prompts for the agent

  • Write a CloudFormation template with a DynamoDB table on PAY_PER_REQUEST and a pk partition key.
  • Add a gsi-index global secondary index and validate the template with aws cloudformation validate-template.
  • Set TTL on the expiresAt attribute of the sessions table.

How to install aws-cloudformation-dynamodb

1Plugin marketplace

/plugin marketplace add giuseppe-trisciuoglio/developer-kit
/plugin install developer-kit-aws@developer-kit

This installs the whole developer-kit-aws plugin with all its skills

2Skills CLI (Vercel)

npx skills add giuseppe-trisciuoglio/developer-kit --skill aws-cloudformation-dynamodb -a claude-code

3Manually: put the files in place

~/.claude/skills/aws-cloudformation-dynamodb/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/aws-cloudformation-dynamodb/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about aws-cloudformation-dynamodb

How do I install aws-cloudformation-dynamodb in Claude Code?

From the marketplace: run /plugin marketplace add giuseppe-trisciuoglio/developer-kit, then /plugin install developer-kit-aws@developer-kit.

What does aws-cloudformation-dynamodb do?

It helps you build a CloudFormation template with a DynamoDB table: keys, indexes, billing mode, encryption, TTL, streams and backups. It also covers deployment order and what to inspect on a rollback.

Can streams be enabled on a table that already exists?

No. They are turned on at creation time, so a template update will not add them to a table that is already running.

Source text

SKILL.md · MIT
---
name: aws-cloudformation-dynamodb
description: Provides AWS CloudFormation patterns for DynamoDB tables, GSIs, LSIs, auto-scaling, and streams. Use when creating DynamoDB tables with CloudFormation, configuring primary keys, local/global secondary indexes, capacity modes (on-demand/provisioned), point-in-time recovery, encryption, TTL, and implementing template structure with Parameters, Outputs, Mappings, Conditions, cross-stack references.
allowed-tools: Read, Write, Bash
---

# AWS CloudFormation DynamoDB Patterns

Provides production-ready NoSQL database infrastructure patterns using AWS CloudFormation templates with DynamoDB tables, GSIs, LSIs, auto-scaling, encryption, TTL, and streams.

## Overview

Covers DynamoDB tables, primary keys, secondary indexes (GSI/LSI), capacity modes, auto-scaling, encryption, TTL, streams, and best practices for parameters, outputs, and cross-stack references.

## When to Use

Creating DynamoDB tables, configuring keys and indexes, setting capacity modes, implementing auto-scaling, enabling encryption/TTL/streams, and organizing CloudFormation templates.

## Instructions

Follow these steps to create DynamoDB tables with CloudFormation:

1. **Define Table Parameters**: Specify table name and billing mode
2. **Configure Primary Key**: Set partition key and optional sort key
3. **Add Secondary Indexes**: Create GSIs for alternative access patterns
4. **Configure Encryption**: Enable encryption using KMS keys
5. **Set Up TTL**: Define timestamp attribute for automatic deletion
6. **Enable Streams**: Configure stream for change data capture
7. **Add Auto Scaling**: Implement Application Auto Scaling for provisioned capacity
8. **Create Backup**: Enable point-in-time recovery
9. **Validate Template**: Run `aws cloudformation validate-template` before deployment
10. **Deploy Stack**: Use `aws cloudformation create-stack` or `update-stack`
11. **Monitor Events**: Check `aws cloudformation describe-stack-events` for failures or `ROLLBACK` status
12. **Handle Rollback**: On failure, review events for resource errors, fix the template, and re-deploy

## Quick Reference

| Resource Type | Purpose |
|---------------|---------|
| `AWS::DynamoDB::Table` | Create DynamoDB table |
| `AWS::ApplicationAutoScaling::ScalableTarget` | Auto scaling configuration |
| `AWS::ApplicationAutoScaling::ScalingPolicy` | Scaling policies |
| `AWS::KMS::Key` | KMS key for encryption |
| `AWS::IAM::Role` | IAM roles for auto scaling |
| BillingMode | `PAY_PER_REQUEST` or `PROVISIONED` |
| SSESpecification | Server-side encryption |

## Examples

### Basic Table with On-Demand Capacity

```yaml
DynamoDBTable:
  Type: AWS::DynamoDB::Table
  Properties:
    TableName: !Sub "${AWS::StackName}-table"
    BillingMode: PAY_PER_REQUEST
    AttributeDefinitions:
      - AttributeName: pk
        AttributeType: S
    KeySchema:
      - AttributeName: pk
        KeyType: HASH
```

### Table with Global Secondary Index

```yaml
DynamoDBTable:
  Type: AWS::DynamoDB::Table
  Properties:
    TableName: !Sub "${AWS::StackName}-table"
    BillingMode: PAY_PER_REQUEST
    AttributeDefinitions:
      - AttributeName: pk
        AttributeType: S
      - AttributeName: gsi-pk
        AttributeType: S
    KeySchema:
      - AttributeName: pk
        KeyType: HASH
    GlobalSecondaryIndexes:
      - IndexName: gsi-index
        KeySchema:
          - AttributeName: gsi-pk
            KeyType: HASH
        Projection:
          ProjectionType: ALL
```

### Table with TTL

```yaml
SessionTable:
  Type: AWS::DynamoDB::Table
  Properties:
    TableName: !Sub "${AWS::StackName}-sessions"
    BillingMode: PAY_PER_REQUEST
    AttributeDefinitions:
      - AttributeName: sessionId
        AttributeType: S
    KeySchema:
      - AttributeName: sessionId
        KeyType: HASH
    TimeToLiveSpecification:
      AttributeName: expiresAt
      Enabled: true
```

### Table with Auto Scaling

```yaml
ScalableTarget:
  Type: AWS::ApplicationAutoScaling::ScalableTarget
  Properties:
    MaxCapacity: 100
    MinCapacity: 5
    ResourceId: !Sub "table/${DynamoDBTable}"
    RoleARN: !GetAtt AutoScalingRole.Arn
    ScalableDimension: dynamodb:table:ReadCapacityUnits
    ServiceNamespace: dynamodb
```

See [references/complete-examples.md](references/complete-examples.md) for more complete examples including encryption, streams, auto scaling, and production tables.

## Template Structure

### Base Template

```yaml
AWSTemplateFormatVersion: 2010-09-09
Description: DynamoDB table with GSI and auto-scaling

Parameters:
  TableName:
    Type: String
    Default: my-table
  BillingMode:
    Type: String
    Default: PAY_PER_REQUEST

Resources:
  DynamoDBTable:
    Type: AWS::DynamoDB::Table
    Properties:
      TableName: !Ref TableName
      BillingMode: !Ref BillingMode

Outputs:
  TableName:
    Value: !Ref DynamoDBTable
  TableArn:
    Value: !GetAtt DynamoDBTable.Arn
```

See [references/advanced-configuration.md](references/advanced-configuration.md) for detailed Parameters, Mappings, Conditions, Outputs, IAM roles, and cross-stack references.

## Best Practices

1. **Use PAY_PER_REQUEST** for development/testing and unpredictable workloads
2. **Enable Point-In-Time Recovery** for production tables
3. **Use KMS encryption** for sensitive data (SSE-KMS)
4. **Configure auto-scaling** for provisioned capacity tables
5. **Design GSIs carefully** - each GSI consumes capacity
6. **Use TTL** for automatic data expiration (sessions, cache)
7. **Enable Streams** for change data capture and analytics
8. **Tag resources** for cost allocation and organization
9. **Export outputs** for cross-stack references
10. **Use Conditions** for environment-specific configurations

## Common Troubleshooting

**Table already exists**: Use unique table names or stack deletion policy
**GSI creation fails**: Verify attribute definitions include GSI attributes
**Auto-scaling not working**: Check IAM role permissions and service-linked role
**TTL not expiring**: Ensure TTL attribute is Number type, not String
**Streams not enabled**: Can only enable streams during table creation
**Encryption errors**: Verify KMS key exists in same region as table

## Related Skills

- [aws-cloudformation-security](../aws-cloudformation-security/) - Security best practices for DynamoDB
- [aws-cloudformation-lambda](../aws-cloudformation-lambda/) - Lambda triggers for DynamoDB Streams
- [aws-cloudformation-iam](../aws-cloudformation-iam/) - IAM roles for DynamoDB access

## References

### Complete Examples
- **[references/complete-examples.md](references/complete-examples.md)** - Basic tables, GSI, LSI, TTL, encryption, PITR, auto-scaling, production tables, global tables, streams

### Advanced Configuration
- **[references/advanced-configuration.md](references/advanced-configuration.md)** - Parameters, Mappings, Conditions, auto scaling policies, streams, TTL, global tables, outputs, IAM roles, deletion policies

## Constraints and Warnings

- **Table names**: Must be unique per region (globally unique for global tables)
- **GSI limits**: Maximum 5 GSIs per table (for single-region tables)
- **LSI limits**: Maximum 5 LSIs per table, same partition key as table
- **Capacity limits**: On-demand has default account limits (40,000 RCUs, 40,000 WCUs)
- **Auto-scaling**: Requires PROVISIONED billing mode (not PAY_PER_REQUEST)
- **Point-in-time recovery**: Can only be enabled during table creation
- **Streams**: Can only be enabled during table creation
- **Encryption**: KMS keys must be in same region as table
- **TTL**: Attribute must be Number type, measured in seconds
- **Throughput**: Each GSI shares provisioned throughput with table
- **Item size limit**: Maximum 400 KB per item
- **Hot partition**: Design keys to avoid hot partition issues

© Giuseppe Trisciuoglio · MIT · giuseppe-trisciuoglio/developer-kit

Similar skills

All skills for Cloud: AWS, Azure, GCP →

From the same set191

The whole set →
pr-review-comments pr-review-comments publishes code review findings from a JSON file as inline comments on a GitHub pull request. Useful for attaching review notes directly to modified lines in a diff. CX Codex +1 2,600installs nestjs-testing nestjs-testing — a rule for NestJS projects: enforces TestingModule for mocked dependencies with Jest, structures E2E tests with Supertest, and prevents real API or database calls during testing. CX Codex +1 ★ 372repo stars nestjs-database-expert nestjs-database-expert — a subagent for Claude Code dedicated to database operations in NestJS, focusing on Drizzle ORM schemas, migrations, transactions, and query patterns. CX Codex ★ 372repo stars devkit.verify-skill devkit.verify-skill is a Claude Code command that checks a skill against DevKit requirements, its template, and dependencies. Run it before publishing or after edits. CX Codex +1 ★ 372repo stars devkit.java.write-unit-tests devkit.java.write-unit-tests generates JUnit 5 tests with Mockito and AssertJ assertions from a Java class path. Useful for testing Spring Boot services, controllers, and utility classes. CX Codex +1 ★ 372repo stars clean-architecture Guides Clean Architecture, DDD, and Hexagonal Architecture in NestJS/TypeScript projects. Use it to shape domain models or separate business rules from framework code. CX Codex +1 ★ 372repo stars spring-boot-backend-development-expert spring-boot-backend-development-expert — a Claude subagent for Spring Boot work: implements REST endpoints, JPA layers and JWT security, and writes the matching tests. CX Codex ★ 372repo stars java-security-expert java-security-expert runs security audits for Java and Spring Boot applications, detects OWASP vulnerabilities, reviews OAuth2 flows, and checks compliance. CX Codex ★ 372repo stars

Project sponsors

Companies that keep this analytics open