本文へ移動
cccskills
無料GitHub で公開

aws-cloudformation-dynamodb

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.

インストール方法を見る

含まれるファイル(5)

  • SKILL.md7.6 KB
  • references/advanced-configuration.md7.5 KB
  • references/complete-examples.md7.7 KB
  • references/examples.md24.2 KB
  • references/reference.md7.7 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

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 TypePurpose
AWS::DynamoDB::TableCreate DynamoDB table
AWS::ApplicationAutoScaling::ScalableTargetAuto scaling configuration
AWS::ApplicationAutoScaling::ScalingPolicyScaling policies
AWS::KMS::KeyKMS key for encryption
AWS::IAM::RoleIAM roles for auto scaling
BillingModePAY_PER_REQUEST or PROVISIONED
SSESpecificationServer-side encryption

Examples

Basic Table with On-Demand Capacity

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

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

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

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 for more complete examples including encryption, streams, auto scaling, and production tables.

Template Structure

Base Template

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 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

References

Complete Examples

Advanced Configuration

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

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Creates new Architecture Decision Record (ADR) documents for significant architectural changes using a consistent template and repository-aware naming and storage guidance. Use when a user or agent decides on an architectural change, needs to document technical rationale, or wants to add a new ADR to the project history.

日本語の概要は準備中です。原文の説明を表示しています。

giuseppe-trisciuoglio/developer-kit3572026年9月10日 更新

aws-cdk

無料

Provides AWS CDK TypeScript patterns for defining, validating, and deploying AWS infrastructure as code. Use when creating CDK apps, stacks, and reusable constructs, modeling serverless or VPC-based architectures, applying IAM and encryption defaults, or testing and reviewing `cdk synth`, `cdk diff`, and `cdk deploy` changes. Triggers include "aws cdk typescript", "create cdk app", "cdk stack", "cdk construct", "cdk deploy", and "cdk test".

日本語の概要は準備中です。原文の説明を表示しています。

giuseppe-trisciuoglio/developer-kit3572026年9月10日 更新

Provides advanced AWS CLI patterns for managing EC2, Lambda, S3, DynamoDB, RDS, VPC, IAM, and CloudWatch. Generates bulk operation scripts, automates cross-service workflows, validates security configurations, and executes JMESPath queries for complex filtering. Triggers on "aws cli help", "aws command line", "aws scripting", "aws automation", "aws batch operations", "aws bulk operations", "aws cli pagination", "aws multi-region", "aws profiles", "aws cli troubleshooting".

日本語の概要は準備中です。原文の説明を表示しています。

giuseppe-trisciuoglio/developer-kit3572026年9月10日 更新

Provides AWS CloudFormation patterns for Auto Scaling including EC2, ECS, and Lambda. Use when creating Auto Scaling groups, launch configurations, launch templates, scaling policies, lifecycle hooks, and predictive scaling. Covers template structure with Parameters, Outputs, Mappings, Conditions, cross-stack references, and best practices for high availability and cost optimization.

日本語の概要は準備中です。原文の説明を表示しています。

giuseppe-trisciuoglio/developer-kit3572026年9月10日 更新

Provides AWS CloudFormation patterns for Amazon Bedrock resources including agents, knowledge bases, data sources, guardrails, prompts, flows, and inference profiles. Use when creating Bedrock agents with action groups, implementing RAG with knowledge bases, configuring vector stores, setting up content moderation guardrails, managing prompts, orchestrating workflows with flows, and configuring inference profiles for model optimization.

日本語の概要は準備中です。原文の説明を表示しています。

giuseppe-trisciuoglio/developer-kit3572026年9月10日 更新

Provides AWS CloudFormation patterns for CloudFront distributions, origins (ALB, S3, Lambda@Edge, VPC Origins), CacheBehaviors, Functions, SecurityHeaders, parameters, Outputs and cross-stack references. Use when creating CloudFront distributions with CloudFormation, configuring multiple origins, implementing caching strategies, managing custom domains with ACM, configuring WAF, and optimizing performance.

日本語の概要は準備中です。原文の説明を表示しています。

giuseppe-trisciuoglio/developer-kit3572026年9月10日 更新

giuseppe-trisciuoglio のスキルをすべて見る

このスキルの問題を報告する