【发布时间】:2021-02-17 11:18:18
【问题描述】:
我正在动态创建一个 AWS-IoT 事物,它可以发布任何主题并可以监听 AWS-IoT-core 代理中的任何主题。
我使用的Policy非常广泛,这个东西可以执行服务器中的所有操作:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "iot:*",
"Resource": "*"
}
]
}
现在我想缩小这些选项。我想让这个东西只发布到主题TOPICS-TEST/# 并只订阅主题TOPICS-TEST/#。尽管我们在代理中有许多不同的主题,但我希望这个东西只能访问以 TOPICS-TEST/ 开头的主题。
为了做到这一点,我检查了this documentation,并创建了这个政策:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"iot:Connect"
],
"Resource": [
"arn:aws:iot:us-east-1:xxxx:client/${iot:Connection.Thing.ThingName}"
]
},
{
"Effect": "Allow",
"Action": [
"iot:Subscribe"
],
"Resource": [
"arn:aws:iot:us-east-1:xxxx:topicfilter/TOPICS-TEST/*"
]
},
{
"Effect": "Allow",
"Action": [
"iot:Receive"
],
"Resource": [
"arn:aws:iot:us-east-1:xxxx:topicfilter/TOPICS-TEST/*"
]
},
{
"Effect": "Allow",
"Action": [
"iot:Publish"
],
"Resource": [
"arn:aws:iot:us-east-1:xxxx:topicfilter/TOPICS-TEST/*"
]
}
]
}
以前的策略不起作用。 我什么都看不到,我什么也不能发表。 我错过了什么?
【问题讨论】:
标签: aws-iot