

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

# 1단계: AWS IoT 정책 생성
<a name="iot-moisture-policy"></a>

Raspberry Pi가 연결하고 메시지를 보낼 수 있도록 허용하는 AWS IoT 정책을 생성합니다 AWS IoT.

1. [AWS IoT 콘솔](https://console.aws.amazon.com/iot)에서 **시작하기** 버튼이 표시되면 선택합니다. 또는 탐색 창에서 **Security**(보안)를 확장한 후 **Policies**(정책)를 선택합니다.

1. **You don’t have any policies yet(아직 정책이 없습니다)** 대화 상자가 나타나면 **Create a policy(정책 생성)**를 선택합니다. 그렇지 않은 경우, **생성**을 선택합니다.

1.  AWS IoT 정책의 이름을 입력합니다(예: **MoistureSensorPolicy**).

1. **설명문 추가** 부분에서 기존 정책을 다음 JSON으로 바꿉니다. {{리전}} 및 {{계정을}} AWS 리전 및 AWS 계정 번호로 바꿉니다.  
****  

   ```
   {
       "Version":"2012-10-17",		 	 	 
       "Statement": [
           {
               "Effect": "Allow",
               "Action": "iot:Connect",
               "Resource": "arn:aws:iot:{{us-east-1}}:123456789012:client/RaspberryPi"
           },
           {
               "Effect": "Allow",
               "Action": "iot:Publish",
               "Resource": [
                   "arn:aws:iot:{{us-east-1}}:123456789012:topic/$aws/things/RaspberryPi/shadow/update",
                   "arn:aws:iot:{{us-east-1}}:123456789012:topic/$aws/things/RaspberryPi/shadow/delete",
                   "arn:aws:iot:{{us-east-1}}:123456789012:topic/$aws/things/RaspberryPi/shadow/get"
               ]
           },
           {
               "Effect": "Allow",
               "Action": "iot:Receive",
               "Resource": [
                   "arn:aws:iot:{{us-east-1}}:123456789012:topic/$aws/things/RaspberryPi/shadow/update/accepted",
                   "arn:aws:iot:{{us-east-1}}:123456789012:topic/$aws/things/RaspberryPi/shadow/delete/accepted",
                   "arn:aws:iot:{{us-east-1}}:123456789012:topic/$aws/things/RaspberryPi/shadow/get/accepted",
                   "arn:aws:iot:{{us-east-1}}:123456789012:topic/$aws/things/RaspberryPi/shadow/update/rejected",
                   "arn:aws:iot:{{us-east-1}}:123456789012:topic/$aws/things/RaspberryPi/shadow/delete/rejected"
               ]
           },
           {
               "Effect": "Allow",
               "Action": "iot:Subscribe",
               "Resource": [
                   "arn:aws:iot:{{us-east-1}}:123456789012:topicfilter/$aws/things/RaspberryPi/shadow/update/accepted",
                   "arn:aws:iot:{{us-east-1}}:123456789012:topicfilter/$aws/things/RaspberryPi/shadow/delete/accepted",
                   "arn:aws:iot:{{us-east-1}}:123456789012:topicfilter/$aws/things/RaspberryPi/shadow/get/accepted",
                   "arn:aws:iot:{{us-east-1}}:123456789012:topicfilter/$aws/things/RaspberryPi/shadow/update/rejected",
                   "arn:aws:iot:{{us-east-1}}:123456789012:topicfilter/$aws/things/RaspberryPi/shadow/delete/rejected"
               ]
           },
           {
               "Effect": "Allow",
               "Action": [
                   "iot:GetThingShadow",
                   "iot:UpdateThingShadow",
                   "iot:DeleteThingShadow"
               ],
               "Resource": "arn:aws:iot:{{us-east-1}}:123456789012:thing/RaspberryPi"
           }
       ]
   }
   ```

1. **생성(Create)**을 선택합니다.