【发布时间】:2019-08-07 17:29:08
【问题描述】:
我正在尝试使用策略限制对我的 AWS IoT 设备的访问,但我的策略似乎没有这样做。它仍然可以让我对设备做任何我想做的事情。该政策实际上是无用的。为了测试这一点,我删除了以下操作。
{
"Effect": "Allow",
"Action": "iot:UpdateThingShadow",
"Resource": "arn:aws:iot:us-east-1:**********:thing/${iot:Connection.Thing.ThingName}"
}
所以现在我的政策是这样的:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "iot:GetThingShadow",
"Resource": "arn:aws:iot:us-east-1:**********:thing/${iot:Connection.Thing.ThingName}"
}
]
}
但是,当我尝试像这样更新我的东西影子时:
var params = {
thingName: "bar",
payload: JSON.stringify({ // payload is in string form according to docs
"state": {
"desired": {
"state": 0
}
}
})
};
await iotdata.updateThingShadow(params, function (err, data) {
if (err){
}
else{
}
});
...它仍然会更新我设备的影子。我的政策说它不能那样做! 如何让我的政策生效?
【问题讨论】: