Lambda to Aws twin maker

0

Hello guys, I am new to AWS. I was trying to take data from my Aws IOT core to AWS twin maker via Lambda function. I have been using this python code :

import json
import boto3

iot_twin_maker_client = boto3.client('iottwinmaker')

def lambda_handler(event, context):
    # Extract event data
    event_data = json.loads(event[1])
    print("temp"+event)

    # Send event data to IoT Twin Maker
    iot_twin_maker_client.update_property_value(
        workspaceId='robot',
        entityId='Hand',
        propertyId='Rotation',
        value=json.dumps(event_data)
    )

    return {
        'statusCode': 200,
        'body': json.dumps('Event data sent to IoT Twin Maker.')
  }

This particular code shows error in the update_property_value part.

That is: [ERROR] AttributeError: 'IoTTwinMaker' object has no attribute 'update_property_value' Traceback (most recent call last): File "/var/task/lambda_function.py", line 12, in lambda_handler iot_twin_maker_client.updatepropertyvalue( File "/var/lang/lib/python3.11/site-packages/botocore/client.py", line 887, in getattr raise AttributeError(

Is there any solve to this? Also what will be the Json code to receive these data in AWS Iot Twin Maker?

  • What error does it give?

  • Attribute error. I am pasting the whole message here: [ERROR] AttributeError: 'IoTTwinMaker' object has no attribute 'update_property_value' Traceback (most recent call last): File "/var/task/lambda_function.py", line 12, in lambda_handler iot_twin_maker_client.updatepropertyvalue( File "/var/lang/lib/python3.11/site-packages/botocore/client.py", line 887, in getattr raise AttributeError(

질문됨 5달 전172회 조회
1개 답변
0
수락된 답변

You are calling update_property_value, that according to the boto3 documentation does not exist. There is a method called batch_put_property_values. Maybe this is the one you should be using.

profile pictureAWS
전문가
Uri
답변함 5달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠