- Newest
- Most votes
- Most comments
Hi. The Device Defender component should subscribe to that topic. You should see something like this in the Device Defender component logs:
2024-05-30T11:13:04.047Z [INFO] (Copier) aws.greengrass.DeviceDefender: stdout. Subscribed to topic $aws/things/GreengrassEC2DeviceFarm-ubuntu-20-04-x86-64/defender/metrics/json/accepted.{scriptName=services.aws.greengrass.DeviceDefender.lifecycle.run.script, serviceName=aws.greengrass.DeviceDefender, currentState=RUNNING}
2024-05-30T11:13:04.055Z [INFO] (Copier) aws.greengrass.DeviceDefender: stdout. Subscribed to topic $aws/things/GreengrassEC2DeviceFarm-ubuntu-20-04-x86-64/defender/metrics/json/rejected.{scriptName=services.aws.greengrass.DeviceDefender.lifecycle.run.script, serviceName=aws.greengrass.DeviceDefender, currentState=RUNNING}
Please confirm that the Device Defender log contains no errors.
The thing to which it is hooked has both publish and subscribe permissions to all topics
You need Publish, Subscribe and Receive. And Subscribe needs a topicfilter resource not topic.
arn:aws:iot:${AWS::Region}:${AWS::AccountId}:topic/$aws/things/${thingName}/defender/*
This isn't the literal string, right? Perhaps share your whole policy.
Also, does greengrass.log have any other errors? You've only given us a very small snippet. Could you perhaps edit the question and give a larger section of the greengrass.log file, particularly if there are other errors or warnings?
Relevant content
asked 4 years ago
- AWS OFFICIALUpdated 5 months ago

Hi, thanks for your answer. I solved it by entering among the get component artifacts resources an ARN that does not refer to a specific account ex (!Sub arn:aws:greengrass:${AWS::Region}::). because it seems that if I enter the specific account id you can't download device defender and then can't subscribe either. For the other policies yes, I put in both subscribe and publish like this:
Anyway it works now
I'm glad it's working, but I'm a little puzzled because
${thingName}is not valid: https://docs.aws.amazon.com/iot/latest/developerguide/thing-policy-variables.html