
CYW954907AEVAL1F Evaluation Kit User Guide, Doc. No. 002-22338 Rev. **
59
Code Examples
Create a Policy
To create a
policy
, perform these steps:
1. In the AWS IoT Console window, go to
Secure > Policies
, and then click the
Create
button. The
Create a policy window appears.
2. Assign a policy name in the
Name
field. For example, 54907_policy.
3. In Add statement, specify the Action as
iot:*
.
4. Assign a Amazon Resource Name (ARN) in the
Resource ARN
field. To use a wildcard, change
the last part of Resource ARN from "
arn:aws:iot:us-east-1:xxxxxxxxxxxx:topic/
replaceWithATopic" to "arn:aws:iot:us-east-1:xxxxxxxxxxxx:*
Notes:
■
Use the region that you selected when you set up your account.
■
Replace xxxxxxxxxxxx with the appropriate value for your ARN.
■
In the ARN name, ensure to change
"topic/replaceWithATopic"
to "*", where "*" indicates
all topics. If you want to use the certificates only for a specific topic (in our case,
"54907_led_onoff"
is the one defined as
WICED_TOPIC
macro in
publish_subscribe.c
), use
the following Resource ARN
"arn:aws:iot:us-east-
1:xxxxxxxxxxxx:54907_led_onoff"
.
5. Select the check box Allow Effect and then click the Create button as shown in
Figure 5-10
.
6. In the created policy window, click to navigate back to the AWS IoT Console window.