1 réponse
- Le plus récent
- Le plus de votes
- La plupart des commentaires
0
Hi. I can see why you might assume there is, but there's no iot-data service. You can replace all iot-data references in the policy with just iot. Then you'll be able to publish. BTW, there's no iot:Close action.
Additionally (if the Lambda is in the same account and region as the IoT Core endpoint you want to use), you don't have to explicitly set the endpoint or the region so you could reduce the code down to something like:
import boto3
import json
import logging
logger = logging.getLogger(__name__)
logger.setLevel("DEBUG")
client = boto3.client('iot-data')
def handler(event, context):
topic = "test/topic"
datum = json.dumps({"a": "b"})
logger.debug(datum)
response = client.publish(
topic=topic,
qos=0,
payload=datum,
retain=True
)
logger.debug(response)
Then you could delete the DescribeEndpoint action from the policy too. And presently, you aren't using the ListNamedShadowsForThing or AttachPolicy actions so these could be deleted too (but you probably know that).
Contenus pertinents
- demandé il y a 2 mois
- demandé il y a un an
- demandé il y a 6 mois
- AWS OFFICIELA mis à jour il y a 2 ans
- AWS OFFICIELA mis à jour il y a 2 ans
Thank you! That did the job