I am working on a Boto3 script that can load the attributes from Cloudtrail into Dynamodb. The format of my cloudtrail logs is JSON. I am fairly new to DynamoDB and I am not sure where I am making a mistake. I'm trying to store "S3BucketName" as well as the name of the bucket which is "goodbucket3". Name for the cloudtrail is "GoodTrail".This is what I have come up with so far. I am getting this error "ResourceNotFoundException: An error occurred (ResourceNotFoundException) when calling the PutItem operation: Requested resource not found"
import boto3
dynamodb = boto3.resource('dynamodb')
table =dynamodb.create_table(
TableName='GoodTable',
AttributeDefinitions=[
{
"AttributeName": "S3BucketName",
"AttributeType": "S"
}
],
KeySchema=[
{
"AttributeName": "S3BucketName",
"KeyType": "HASH"
}
],
ProvisionedThroughput={
"ReadCapacityUnits": 1,
"WriteCapacityUnits": 1
}
)
table = dynamodb.Table('GoodTable')
response = table.put_item(
Item= {
'S3BucketName': 'some-bucket-name',
'content': f'{path}',
}
)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…