DynamoOps
Schema and infrastructure

Export Schema (IaC)

Turn a live table into infrastructure code. Copy its schema as CloudFormation YAML, Terraform HCL or Pulumi TypeScript, including attributes, keys, GSIs, LSIs and TTL.

The Export Schema dialog

Click Schema in the table info bar. The dialog has three format tabs and a read-only code view generated entirely on your machine from the table description already loaded. Copy to Clipboard puts the whole document on the clipboard.

Export Schema with the Terraform tab selected.
AWSTemplateFormatVersion: '2010-09-09'
Description: DynamoDB table schema exported from DynamoOps
Resources:
  Orders:
    Type: AWS::DynamoDB::Table
    Properties:
      TableName: orders
      BillingMode: PAY_PER_REQUEST
      AttributeDefinitions:
        - AttributeName: customerId
          AttributeType: S
        - AttributeName: orderDate
          AttributeType: S
        - AttributeName: status
          AttributeType: S
      KeySchema:
        - AttributeName: customerId
          KeyType: HASH
        - AttributeName: orderDate
          KeyType: RANGE
      GlobalSecondaryIndexes:
        - IndexName: status-index
          KeySchema:
            - AttributeName: status
              KeyType: HASH
          Projection:
            ProjectionType: ALL
Outputs:
  OrdersArn:
    Value: !GetAtt Orders.Arn
    Export:
      Name: !Sub '${AWS::StackName}-orders-arn'

What is included

IncludedNot included
Table name and billing modeProvisioned read and write capacity values
Attribute definitions and key schemaStream specification
Global secondary indexes with keys, projection type and non-key attributesEncryption (SSE/KMS) settings
Local secondary indexesPoint-in-time recovery, table class, deletion protection
TTL block when the description reports TTL enabledGlobal-table replicas and your real AWS tags
  • Terraform and Pulumi add a ManagedBy = "DynamoOps" tag; CloudFormation adds an Outputs block exporting the table ARN.
  • Resource names are derived from the table name: alphanumeric for the CloudFormation logical ID, lower-case with underscores for Terraform and the Pulumi variable.
Provisioned tables need a capacity block
The export always writes the billing mode it finds but never capacity values. If the source table is provisioned, add read_capacity and write_capacity (or the CloudFormation and Pulumi equivalents) before applying, or switch the resource to on-demand.

Suggested workflow

  • Prototype the table and its indexes in DynamoOps against a dev account.
  • Export the schema, paste it into your infrastructure repository and review the diff.
  • Import the existing table into state (terraform import or pulumi import) if the table should stay, or let IaC recreate it in the next environment.
  • Generate the matching data access layer with the SDK generator.

Related