Amazon DynamoDB Operations: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(3 intermediate revisions by the same user not shown)
Line 18: Line 18:
==AWS::DynamoDB::Table==
==AWS::DynamoDB::Table==


{{External|[https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-reference-dynamodb.html AWS::DynamoDB::Table]}}
{{External|[https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dynamodb-table.html AWS::DynamoDB::Table]}}


  Resources:
  Resources:
Line 24: Line 24:
     Type: AWS::DynamoDB::Table
     Type: AWS::DynamoDB::Table
     Properties:
     Properties:
      TableName: test
       AttributeDefinitions:
       AttributeDefinitions:
         - AttributeName: kv/key
         - AttributeName: kv/key
Line 31: Line 32:
         - AttributeName: kv/index2
         - AttributeName: kv/index2
           AttributeType: S
           AttributeType: S
       BillingMode: String
      KeySchema:
        - AttributeName: kv/key
          KeyType: HASH
      SSESpecification:
        SSEEnabled: true
      GlobalSecondaryIndexes:
        - IndexName: kv_index1
          KeySchema:
            - AttributeName: kv/index1
              KeyType: HASH
          Projection:
            ProjectionType: KEYS_ONLY
        - IndexName: kv_index2
          KeySchema:
            - AttributeName: kv/index2
              KeyType: HASH
          Projection:
            ProjectionType: KEYS_ONLY
       BillingMode: PAY_PER_REQUEST
      StreamSpecification:
        StreamViewType: NEW_AND_OLD_IMAGES
       GlobalSecondaryIndexes:
       GlobalSecondaryIndexes:
         - GlobalSecondaryIndexes
         - <font color=darkgray>''GlobalSecondaryIndexes''</font>
      KeySchema:
        - KeySchema
       LocalSecondaryIndexes:
       LocalSecondaryIndexes:
         - LocalSecondaryIndexes
         - <font color=darkgray>''LocalSecondaryIndexes''</font>
       PointInTimeRecoverySpecification:  
       PointInTimeRecoverySpecification:  
         PointInTimeRecoverySpecification
         <font color=darkgray>''PointInTimeRecoverySpecification''</font>
       ProvisionedThroughput:
       ProvisionedThroughput:
         ProvisionedThroughput
         <font color=darkgray>''ProvisionedThroughput''</font>
      SSESpecification:
        SSESpecification
      StreamSpecification:
        StreamSpecification
      TableName: String
      Tags:
        - Resource Tag
       TimeToLiveSpecification:  
       TimeToLiveSpecification:  
         TimeToLiveSpecification
         <font color=darkgray>''TimeToLiveSpecification''</font>
      Tags:
        - Key: Name
          Value: test-dynamodb-table


===Attribute Definition===
===Attribute Definition===
Line 61: Line 76:


===SSE Specification===
===SSE Specification===
===Global Secondary Indexes===
{{External|[https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dynamodb-gsi.html Amazon DynamoDB Table GlobalSecondaryIndex]}}

Latest revision as of 00:28, 25 April 2019

Internal

CLI

aws dynamodb create-table \
  --table-name some-table
  --attribute-definitions AttributeName=kv/key,AttributeType=S AttributeName=kv/index1,AttributeType=S AttributeName=kv/index2,AttributeType=S \
  --key-schema AttributeName=kv/key,KeyType=HASH \
  --sse-specification Enabled=true,SSEType=KMS \
  --global-secondary-indexes 'IndexName=kv_index1,KeySchema=[{AttributeName=kv/index1,KeyType=HASH}],Projection={ProjectionType=KEYS_ONLY}' 'IndexName=kv_index2,KeySchema=[{AttributeName=kv/index2,KeyType=HASH}],Projection={ProjectionType=KEYS_ONLY}' \
  --billing-mode PAY_PER_REQUEST \
  --stream-specification StreamEnabled=true,StreamViewType=NEW_AND_OLD_IMAGES

CloudFormation Support

AWS::DynamoDB::Table

AWS::DynamoDB::Table
Resources:
  DyamoDBTable:
    Type: AWS::DynamoDB::Table
    Properties:
      TableName: test
      AttributeDefinitions:
        - AttributeName: kv/key
          AttributeType: S
        - AttributeName: kv/index1
          AttributeType: S
        - AttributeName: kv/index2
          AttributeType: S
      KeySchema:
        - AttributeName: kv/key
          KeyType: HASH
      SSESpecification:
        SSEEnabled: true
      GlobalSecondaryIndexes:
        - IndexName: kv_index1
          KeySchema:
            - AttributeName: kv/index1
              KeyType: HASH
          Projection:
            ProjectionType: KEYS_ONLY
        - IndexName: kv_index2
          KeySchema:
            - AttributeName: kv/index2
              KeyType: HASH
          Projection:
            ProjectionType: KEYS_ONLY
      BillingMode: PAY_PER_REQUEST
      StreamSpecification:
        StreamViewType: NEW_AND_OLD_IMAGES
      GlobalSecondaryIndexes:
        - GlobalSecondaryIndexes
      LocalSecondaryIndexes:
        - LocalSecondaryIndexes
      PointInTimeRecoverySpecification: 
        PointInTimeRecoverySpecification
      ProvisionedThroughput:
        ProvisionedThroughput
      TimeToLiveSpecification: 
        TimeToLiveSpecification
      Tags:
        - Key: Name
          Value: test-dynamodb-table

Attribute Definition

Amazon DynamoDB Table AttributeDefinition

Key Schema

Amazon DynamoDB Table KeySchema

SSE Specification

Global Secondary Indexes

Amazon DynamoDB Table GlobalSecondaryIndex