Create example IoT Thing policy (#731)

* Create example claim policy and update formatting on previous examples

* Add trailing linebreak
This commit is contained in:
johnrhen 2021-12-14 11:31:41 -08:00 committed by GitHub
parent 4610b37ade
commit a727061dc2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 95 additions and 85 deletions

View file

@ -1,31 +1,31 @@
{ {
"Version": "2012-10-17", "Version": "2012-10-17",
"Statement": [ "Statement": [
{ {
"Effect": "Allow", "Effect": "Allow",
"Action": [ "Action": [
"iot:Connect" "iot:Connect"
], ],
"Resource": "*" "Resource": "*"
}, },
{ {
"Effect": "Allow", "Effect": "Allow",
"Action": [ "Action": [
"iot:Publish", "iot:Publish",
"iot:Receive" "iot:Receive"
], ],
"Resource": [ "Resource": [
"arn:aws:iot:<aws-region>:<aws-account-id>:topic/$aws/certificates/create-from-csr/*", "arn:aws:iot:<aws-region>:<aws-account-id>:topic/$aws/certificates/create-from-csr/*",
"arn:aws:iot:<aws-region>:<aws-account-id>:topic/$aws/provisioning-templates/<template-name>/provision/*" "arn:aws:iot:<aws-region>:<aws-account-id>:topic/$aws/provisioning-templates/<template-name>/provision/*"
] ]
}, },
{ {
"Effect": "Allow", "Effect": "Allow",
"Action": "iot:Subscribe", "Action": "iot:Subscribe",
"Resource": [ "Resource": [
"arn:aws:iot:<aws-region>:<aws-account-id>:topicfilter/$aws/certificates/create-from-csr/*", "arn:aws:iot:<aws-region>:<aws-account-id>:topicfilter/$aws/certificates/create-from-csr/*",
"arn:aws:iot:<aws-region>:<aws-account-id>:topicfilter/$aws/provisioning-templates/<template-name>/provision/*" "arn:aws:iot:<aws-region>:<aws-account-id>:topicfilter/$aws/provisioning-templates/<template-name>/provision/*"
] ]
} }
] ]
} }

View file

@ -1,54 +1,54 @@
{ {
"Parameters": { "Parameters": {
"SerialNumber": { "SerialNumber": {
"Type": "String" "Type": "String"
}, },
"AWS::IoT::Certificate::Id": { "AWS::IoT::Certificate::Id": {
"Type": "String" "Type": "String"
} }
}, },
"Resources": { "Resources": {
"certificate": { "certificate": {
"Properties": { "Properties": {
"CertificateId": { "CertificateId": {
"Ref": "AWS::IoT::Certificate::Id" "Ref": "AWS::IoT::Certificate::Id"
}, },
"Status": "Active" "Status": "Active"
}, },
"Type": "AWS::IoT::Certificate" "Type": "AWS::IoT::Certificate"
}, },
"policy": { "policy": {
"Properties": { "Properties": {
"PolicyName": "<provisioned-thing-policy>" "PolicyName": "<provisioned-thing-policy>"
}, },
"Type": "AWS::IoT::Policy" "Type": "AWS::IoT::Policy"
}, },
"thing": { "thing": {
"OverrideSettings": { "OverrideSettings": {
"AttributePayload": "MERGE", "AttributePayload": "MERGE",
"ThingGroups": "DO_NOTHING", "ThingGroups": "DO_NOTHING",
"ThingTypeName": "REPLACE" "ThingTypeName": "REPLACE"
}, },
"Properties": { "Properties": {
"AttributePayload": {}, "AttributePayload": {},
"ThingGroups": [], "ThingGroups": [],
"ThingName": { "ThingName": {
"Fn::Join": [ "Fn::Join": [
"", "",
[ [
"fp_demo_", "fp_demo_",
{ {
"Ref": "SerialNumber" "Ref": "SerialNumber"
} }
] ]
] ]
}, },
"ThingTypeName": "fp_demo_things" "ThingTypeName": "fp_demo_things"
}, },
"Type": "AWS::IoT::Thing" "Type": "AWS::IoT::Thing"
} }
}, },
"DeviceConfiguration": { "DeviceConfiguration": {
"Foo": "Bar" "Foo": "Bar"
} }
} }

View file

@ -0,0 +1,10 @@
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "iot:Connect",
"Resource": "arn:aws:iot:<aws-region>:<aws-account-id>:*"
}
]
}