Skip to content

Commit 469a8c9

Browse files
committed
Update the demo instructions in readme files
1 parent 197e399 commit 469a8c9

File tree

4 files changed

+96
-11
lines changed

4 files changed

+96
-11
lines changed

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ cmake -S . -Bbuild -DAWS_IOT_ENDPOINT="<your-aws-iot-endpoint>" -DROOT_CA_CERT_P
443443

444444
An Amazon Root CA certificate can be downloaded from [here](https://www.amazontrust.com/repository/).
445445

446-
To create a provisioning template and claim credentials, sign into your AWS account and visit [here][create_provtemplate]. Make sure to enable the "Use the AWS IoT registry to manage your device fleet" option. Once
446+
To create a provisioning template and claim credentials, sign into your AWS account and follow the steps given in the [readme.md in the demo folder](./demos/fleet_provisioning/readme.md) and visit [here][create_provtemplate]. Make sure to enable the "Use the AWS IoT registry to manage your device fleet" option. Once
447447
you have created the template and credentials, modify the claim certificate's policy to match the [sample policy][sample_claim_policy].
448448

449449
In order to set these configurations manually, edit `demo_config.h` in the demo folder to `#define` the following:
@@ -505,6 +505,20 @@ The following creates a job that specifies a Linux Kernel link for downloading.
505505
--targets arn:aws:iot:us-west-2:<account-id>:thing/<thing-name> \
506506
--document '{"url":"https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.8.5.tar.xz"}'
507507
```
508+
3. After this we need to run the demo using the command:
509+
```
510+
/build/bin/jobs_demo_mosquitto
511+
```
512+
the above command will give all he instructions on how to run the demo. It will ask you to run the following command to run the demo:
513+
514+
```
515+
./build/bin/jobs_demo_mosquitto \
516+
-n <thing-name> \
517+
-h <aws-iot endpoint> \
518+
--certfile <device certificate of the thing> \
519+
--keyfile <private key of the thing>
520+
```
521+
508522

509523
#### Setup for the Greengrass local auth demo
510524

@@ -629,6 +643,7 @@ Any version after 1.6.14 will drop privileges as soon as the configuration file
629643
openssl req -x509 -nodes -sha256 -days 365 -newkey rsa:2048 -keyout ca.key -out ca.crt
630644
```
631645
646+
When asked for the Common Name (CN) after running the following command enter the same value as was added for the macro `BROKER_ENDPOINT` in the demo_config.h file, which in our case is just `localhost`
632647
```sh
633648
# Generate server key and certificate.# Provide the Subject field information as appropriate for Server certificate. Make sure the Common Name (CN) field is different from the root CA certificate.
634649
openssl req -nodes -sha256 -new -keyout server.key -out server.csr # Sign with the CA cert.

demos/fleet_provisioning/readme.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
## Setup for Fleet Provisioning Demos
2+
3+
### Creating the Provisioning Policy
4+
5+
1. Login to your AWS account and open AWS IoT Core. On the side bar click on security > policies > create policy
6+
2. Set a relevant policy name
7+
3. Copy the contents in the demos/fleet_provisioning/fleet_provisioning_with_csr(or fleet_provisioning_keys_cert_demo)/example_claim_policy.json and paste it in the policy document on the AWS console.
8+
4. Create the policy
9+
10+
11+
### Creating the Claim Certificate
12+
13+
1. On the side bar of the AWS IoT Core click on security > certificates > add certificate. Make the “Certificate Status” active and download the certificate files from the prompt given.
14+
2. Set the value of the macro CLAIM_CERT_PATH in the democonfig.h file to the path of the certificate downloaded and set the value of the macro CLAIM_PRIVATE_KEY_PATH in the democonfig.h file to the path of the private key downloaded. Alternatively you can set the values of these through command line parameters.
15+
3. Now click on the certificate > attach policies > select your provisioning policy made in the previous section and select attach policy.
16+
17+
18+
### Creating the IAM role for AWS IoT to create resources
19+
20+
1. Go to the IAM Identity center and create a new IAM role
21+
2. Select AWS IoT when asked to select a service
22+
23+
24+
### Creating Fleet Provisioning Template
25+
26+
1. Go to AWS IoT Core > Connect many devices > Connect many devices > create provisioning template.
27+
2. Select Provisioning devices with claim certificates > next
28+
3. Set the status to active
29+
4. Enter template name
30+
5. Enter the IAM role you created in the previous section or you can create a new one if you have not yet created it
31+
6. Enter the provisioning policy that you made in the very first section or create a new one if you havn’t already
32+
7. We do not need to do any pre-provisioning stuff hence we will select “Don’t use a pre-provisioning action”
33+
8. Turn the automatic thing creation option on and click next
34+
9. Select a policy that you wish your device should have when it is running (Permissions to connet to IoT, subscribe to some topic, publish to some topic extra) or make a new one if you do not have one already.
35+
10. Click next, review and create.
36+
37+
### Configuring the demo
38+
Set all the necessary macro values in the demo_config.h file or alternatively you can set the values of these through command line parameters.
39+

demos/greengrass/greengrass_demo_local_auth/README.md

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,50 @@ For setting up the Greengrass core, see [the Greengrass getting started guide](h
5050

5151
Next you will need to set up a Root CA for your Greengrass device.
5252

53-
On the Greengrass core, run the following command:
53+
On the Greengrass core, run the following:
5454

55+
1. Create private key for the CA certificate
5556
```sh
56-
openssl req -x509 -new -nodes -key ca.key -sha256 -days 1826 -out ca.crt
57+
openssl genrsa -out ca.key 2048
5758
```
59+
2. Use the private key of CA to generate a self signed certificate
60+
```sh
61+
openssl req -x509 -new -nodes \
62+
-key ca.key \
63+
-sha256 -days 1024 \
64+
-out ca.pem
65+
```
66+
3. Create a private key for the Thing device.
67+
```sh
68+
openssl genrsa -out thing_private.key 2048
69+
```
70+
4. Using the private key, create a certificate signing request
71+
```sh
72+
openssl req -new \
73+
-key thing_private.key \
74+
-out thing_csr.csr
75+
```
76+
5. Using the CSR, root CA and private key of root CA , create the client certificate
77+
```sh
78+
openssl x509 -req \
79+
-in thing_csr.csr \
80+
-CA ca.pem \
81+
-CAkey ca.key \
82+
-CAcreateserial \
83+
-out thing_cert.pem \
84+
-days 500 -sha256
85+
```
86+
6. Register the CA certificate to AWS IoT by going to AWS console → AWS IoT → Security → Certificates authorities → Register CA certificate. Upload the CA certificate and CA status to active, leave other settings as default. Click on Register.
87+
88+
7. Register the Device certificate to AWS IoT
89+
90+
* Go to console → AWS IoT → Security → Certificates → Add certificate → Register certificates.
91+
* Select your Registered CA from the dropdown.
92+
* Upload your device certificate (thing_cert.pem) and Activate it by selecting the certificate and clicking on the Activate button
93+
94+
8. Create a new thing and link it with this new certificate thing_cert.pem and set the value of the macro `THING_NAME` in demo_config.h file to the name of this new thing
5895

59-
This will create a custom CA cert ca.crt and private key ca.key.
96+
9. Set the value of the macro `CLIENT_CERT_PATH` to the path of thing_cert.pem and the value of the macro `CLIENT_PRIVATE_KEY_PATH` thing_private.key
6097

6198
### Configuring the GG core for local auth and MQTT
6299

@@ -68,7 +105,7 @@ Deploy the following components to your Greengrass core:
68105

69106
Set the configuration for the aws.greengrass.clientdevices.Auth component based
70107
off the [provided config](./greengrass_auth_conf.json). Ensure the certificate
71-
paths match the files created for your custom CA above.
108+
paths match the files created for your custom CA above and their absolute paths are written after `file://`
72109

73110
This config will allow associated Things to publish and subscribe to any topic
74111
on the Greengrass core broker.

demos/http/common/include/http_demo_s3_utils.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,6 @@ extern size_t securityTokenLen;
9191
*/
9292
extern const char * pExpiration;
9393

94-
/**
95-
* @brief Length of expiration time for the temporary credentials retrieved
96-
* from AWS IoT credential provider service.
97-
*/
98-
size_t expirationLen;
99-
10094
/**
10195
* @brief Retrieve the temporary credentials from AWS IOT Credential Provider.
10296
*

0 commit comments

Comments
 (0)