awslabs / aws-iot-certificate-vending-machine

The CVM allows a device to apply for its own certificate and installation.
Apache License 2.0
83 stars 16 forks source link

Best policy practices for production #3

Closed eercanayar closed 6 years ago

eercanayar commented 6 years ago

In config.js line 11;

// In actual production, the policy document should be generated dynamically.

Isn't it a waste that generating a policy for every single thing? Assume that thousands of devices for an IoT solution. I think it should be only a single policy which allows publish and subscribe to topics by their certificate ID's. An example from AWS IoT docs is like this:

{
    "Version": "2012-10-17",
    "Statement": [{
        "Effect": "Allow",
        "Action":["iot:Publish"],
        "Resource": ["arn:aws:iot:us-east-1:123456789012:topic/${iot:CertificateId}"]
    },
    {
        "Effect": "Allow",
        "Action": ["iot:Connect"],
        "Resource": ["*"]
    }]
}

What do you think about this, what are your recommendations about that?

cncoder commented 6 years ago