import boto3
      
      # Get the service resource.
      dynamodb = boto3.resource('dynamodb')
      # Create the DynamoDB table.
      table = dynamodb.create_table(
        TableName='table',
        KeySchema=[
          {
            'AttributeName': 'attribute_name',
            'KeyType': 'HASH'
          },
          {
            'AttributeName': 'attribute_name',
            'KeyType': 'RANGE'
          }
        ],
        AttributeDefinitions=[
          {
            'AttributeName': 'attribute_name',
            'AttributeType': 'S'
          },
          {
            'AttributeName': 'attribute_name',
            'AttributeType': 'S'
          },
        ],
        ProvisionedThroughput={
          'ReadCapacityUnits': 5,
          'WriteCapacityUnits': 5
        }
      )
      # Wait until the table exists.
      table.wait_until_exists()
      # Print out some data about the table.
      print(table.item_count)
      
      
      Python language logo
      your recipe card header background

      Dynamodb - create a table

      AWS and boto3 recipes for Python

      Library: boto3

      Shortcut: aws.dynamodb.create_table

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.