AWS::IoT::Policy
Use the AWS::IoT::Policy resource to declare an Amazon IoT policy. For more
information about working with Amazon IoT policies, see Authorization in the
Amazon IoT Developer Guide.
Syntax
To declare this entity in your Amazon CloudFormation template, use the following syntax:
JSON
{ "Type" : "AWS::IoT::Policy", "Properties" : { "PolicyDocument" :Json, "PolicyName" :String} }
YAML
Type: AWS::IoT::Policy Properties: PolicyDocument:JsonPolicyName:String
Properties
PolicyDocument-
The JSON document that describes the policy.
Required: Yes
Type: Json
Update requires: No interruption
PolicyName-
The policy name.
Required: No
Type: String
Update requires: Replacement
Return values
Ref
When you pass the logical ID of this resource to the intrinsic Reffunction, Refreturns the policy name. For example:
{ "Ref": "MyPolicy" }
For more information about using the Reffunction, see Ref.
Fn::GetAtt
The Fn::GetAttintrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.
For more information about using the Fn::GetAttintrinsic function, see Fn::GetAtt.
Examples
The following example declares an Amazon IoT policy. This example grants permission to connect to Amazon IoT with client ID client1.
JSON
{ "Type":"AWS::IoT::Policy", "Properties":{ "PolicyDocument":{ "Version":"2012-10-17", "Statement":[ { "Effect":"Allow", "Action":[ "iot:Connect" ], "Resource":[ "arn:aws:iot:us-east-1:123456789012:client/client1" ] } ] }, "PolicyName":"PolicyName" } }
YAML
Type: AWS::IoT::Policy Properties: PolicyDocument: Version: '2012-10-17' Statement: - Effect: Allow Action: - iot:Connect Resource: - arn:aws:iot:us-east-1:123456789012:client/client1 PolicyName: PolicyName