

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

# 사물 정책 예제
<a name="thing-policy-examples"></a>

다음 정책은를 인증하는 데 사용되는 인증서 AWS IoT Core 가 정책이 평가되는 사물에 연결된 경우 디바이스가 연결되도록 허용합니다.

****  

```
{  
    "Version":"2012-10-17",		 	 	 
    "Statement":[
        {  
            "Effect":"Allow",
            "Action":["iot:Connect"],
            "Resource":[ "*" ],
            "Condition": {
                "Bool": {
                    "iot:Connection.Thing.IsAttached": ["true"]
            }
        }
        }
    ]
}
```

다음 정책은 인증서가 특정 사물 유형의 사물에 연결되어 있고 사물에 값 `attributeValue`가 있는 `attributeName`의 속성이 있는 경우 디바이스가 게시할 수 있도록 허용합니다. 사물 정책 변수에 대한 자세한 내용은 [사물 정책 변수](thing-policy-variables.md)를 참조하세요.

****  

```
{
  "Version":"2012-10-17",		 	 	 
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "iot:Publish"
      ],
      "Resource": "arn:aws:iot:us-east-1:123456789012:topic/device/stats",
      "Condition": {
        "StringEquals": {
          "iot:Connection.Thing.Attributes[attributeName]": "attributeValue",
          "iot:Connection.Thing.ThingTypeName": "Thing_Type_Name"
        },
        "Bool": {
          "iot:Connection.Thing.IsAttached": "true"
        }
      }
    }
  ]
}
```

다음 정책은 디바이스가 사물의 속성으로 시작하는 주제에 게시할 수 있도록 허용합니다. 디바이스 인증서가 사물과 연결되어 있지 않으면 이 변수가 해결되지 않고 액세스 거부 오류가 발생합니다. 사물 정책 변수에 대한 자세한 내용은 [사물 정책 변수](thing-policy-variables.md)를 참조하세요.

****  

```
{
  "Version":"2012-10-17",		 	 	 
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "iot:Publish"
      ],
      "Resource": "arn:aws:iot:us-east-1:123456789012:topic/${iot:Connection.Thing.Attributes[attributeName]}/*"
    }
  ]
}
```