forked from sdcloud92/Python_Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDynamoDB-create-table.py
More file actions
34 lines (32 loc) · 840 Bytes
/
DynamoDB-create-table.py
File metadata and controls
34 lines (32 loc) · 840 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import json
import boto3
client = boto3.client('dynamodb')
def lambda_handler(event, context):
response = client.create_table(
AttributeDefinitions=[
{
'AttributeName': 'customerID',
'AttributeType': 'S'
},
{
'AttributeName': 'Product',
'AttributeType': 'S'
},
],
TableName='RetailSales24022023',
KeySchema=[
{
'AttributeName': 'customerID',
'KeyType': 'HASH'
},
{
'AttributeName': 'Product',
'KeyType': 'RANGE'
},
],
ProvisionedThroughput={
'ReadCapacityUnits': 1,
'WriteCapacityUnits': 1
},
)
print(response)