AWS IoT
开发人员指南
AWS 服务或AWS文档中描述的功能,可能因地区/位置而异。请点击 Amazon AWS 入门,可查看中国地区的具体差异

连接策略示例

以下策略允许一组客户端 ID 建立连接:

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "iot:Connect" ], "Resource": [ "arn:aws:iot:us-east-1:123456789012:client/clientid1", "arn:aws:iot:us-east-1:123456789012:client/clientid2", "arn:aws:iot:us-east-1:123456789012:client/clientid3" ] }, { "Effect": "Allow", "Action": [ "iot:Publish", "iot:Subscribe", "iot:Receive" ], "Resource": [ "*" ] } ] }

以下策略禁止一组客户端 ID 建立连接:

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Deny", "Action": [ "iot:Connect" ], "Resource": [ "arn:aws:iot:us-east-1:123456789012:client/clientid1", "arn:aws:iot:us-east-1:123456789012:client/clientid2" ] }, { "Effect": "Allow", "Action": [ "iot:Connect" ], "Resource": [ "*" ] } ] }

以下策略允许证书持有者使用任何客户端 ID 订阅主题筛选条件 foo/*

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "iot:Connect" ], "Resource": [ "*" ] }, { "Effect": "Allow", "Action": [ "iot:Subscribe" ], "Resource": [ "arn:aws:iot:us-east-1:123456789012:topicfilter/foo/*" ] } ] }