I am new to AWS. I'm trying to get data from DynamoDB table and display the item details in a webpage using a lambda function. Lambda function uses either nodejs or python.
It's a MQTT related project, I have created things and subscribe to the topic in AWS. Using MQTT BOX tool, I have published the data. It will be stored in base64 encryption in a DynamoDB table.
Here is my python code in the lambda function,
import boto3
import json
import os
s3 = boto3.client('s3')
ddb = boto3.response('dynamodb')
table = ddb.Table('ioTDaxxx')
def lambda_handler(event, context):
response = table.scan()
body = json.dumbs(response['Items'])
response = s3.put_object(Bucket='mqttxxx',
Key='hello.json',
Body=body,
ContentType='application/json')
It gives an error "module initialization error: module 'boto3' has no attribute 'response'". I don't know whether its correct code.
Kindly share me any sample code to fetch the data from DynamoDB table.