CmdID

CmdID / aws / aws iot

aws iot create-provisioning-template

Creates a provisioning template. AWS CLI reference

1 example 8 options Its page in the AWS CLI reference

Opens CmdID with your command. It is read in your browser and sent nowhere.

Examples

from aws-cli, each command read by CmdID

To create a provisioning template

The following create-provisioning-template example creates a provisioning template as defined by the file template.json.

aws iot create-provisioning-template --template-name widget-template --description "A provisioning template for widgets" --provisioning-role-arn arn:aws:iam::123456789012:role/Provision_role --template-body file://template.jsonIdentify
--template-nameThe name of the provisioning template.
--descriptionThe description of the provisioning template.
--provisioning-role-arnThe role ARN for the role associated with the provisioning template.
--template-bodyThe JSON formatted contents of the provisioning template.

Contents of template.json:

{
    "Parameters" : {
        "DeviceLocation": {
            "Type": "String"
        }
    },
    "Mappings": {
        "LocationTable": {
            "Seattle": {
                "LocationUrl": "https://example.aws"
            }
        }
    },
    "Resources" : {
        "thing" : {
            "Type" : "AWS::IoT::Thing",
            "Properties" : {
                "AttributePayload" : {
                    "version" : "v1",
                    "serialNumber" : "serialNumber"
                },
                "ThingName" : {"Fn::Join":["",["ThingPrefix_",{"Ref":"SerialNumber"}]]},
                "ThingTypeName" : {"Fn::Join":["",["ThingTypePrefix_",{"Ref":"SerialNumber"}]]},
                "ThingGroups" : ["widgets", "WA"],
                "BillingGroup": "BillingGroup"
            },
            "OverrideSettings" : {
                "AttributePayload" : "MERGE",
                "ThingTypeName" : "REPLACE",
                "ThingGroups" : "DO_NOTHING"
            }
        },
        "certificate" : {
            "Type" : "AWS::IoT::Certificate",
            "Properties" : {
                "CertificateId": {"Ref": "AWS::IoT::Certificate::Id"},
                "Status" : "Active"
            }
        },
        "policy" : {
            "Type" : "AWS::IoT::Policy",
            "Properties" : {
                "PolicyDocument" : {
                    "Version": "2012-10-17",
                    "Statement": [{
                        "Effect": "Allow",
                        "Action":["iot:Publish"],
                        "Resource": ["arn:aws:iot:us-west-2:123456789012:topic/foo/bar"]
                    }]
                }
            }
        }
    },
    "DeviceConfiguration": {
        "FallbackUrl": "https://www.example.com/test-site",
        "LocationUrl": {
            "Fn::FindInMap": ["LocationTable",{"Ref": "DeviceLocation"}, "LocationUrl"]}
        }
    }
}
Its output
{
    "templateArn": "arn:aws:iot:us-west-2:123456789012:provisioningtemplate/widget-template",
    "templateName": "widget-template",
    "defaultVersionId": 1
}

For more information, see AWS IoT Secure Tunneling in the AWS IoT Core Developer Guide.

Options

8 in the AWS CLI reference
--descriptionThe description of the provisioning template.
--enabledTrue to enable the provisioning template, otherwise false.
--pre-provisioning-hookCreates a pre-provisioning hook template.
--provisioning-role-arnThe role ARN for the role associated with the provisioning template.
--tagsMetadata which can be used to manage the provisioning template.
--template-bodyThe JSON formatted contents of the provisioning template.
--template-nameThe name of the provisioning template.
--typeThe type you define in a provisioning template.