<commit_before># iot-aws-go

This is a small project illustrating how to use golang to provision then connect to the [Amazon Webservices IoT Service](https://aws.amazon.com/iot/).

# preperation

To get started with this project you will need to register an [Amazon Webservices](https://aws.amazon.com/) account and download some credentials. I recommend following the [aws cli setup](http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-set-up.html).

Once configured your credentials in the aws cli, and tested them, you are ready to follow the provision section below.

Make sure you have `godep` installed and `$GOPATH/bin` is a in your `$PATH`.

```
go get -u github.com/godep/godep
```

# building

Clone this project into your `$GOPATH`.

```
mkdir -p $GOPATH/src/github.com/wolfeidau
cd $GOPATH/src/github.com/wolfeidau
git clone https://github.com/wolfeidau/aws-iot-go
```

Run make to build and install in `$GOPATH/bin`.

```
make
```

# provision

To provision a new thing based on the preconfigured template.

```
iotprov create --type light --name kitchen_light
```

To create a certificate, policy and link it to the thing you just created, this will save the credentials in `[name].yml` in the current directory.

```
iotprov certificate --name kitchen_light
```

To list things.

```
iotprov list --type light
```

Some things to note:

* Create is idemptotent as long as you have the matching type
* Currently defaults to us-west-2 as it is closest to Australia
* This will attempt to load the default AWS credentials you loaded when configuring the aws cli or you can export `AWS_PROFILE` to specify one.

# connect

To connect the iot device using the credentials you just generated.
<commit_msg>Clarify the certificate provisioning process.<commit_after># iot-aws-go

This is a small project illustrating how to use golang to provision then connect to the [Amazon Webservices IoT Service](https://aws.amazon.com/iot/).

# preperation

To get started with this project you will need to register an [Amazon Webservices](https://aws.amazon.com/) account and download some credentials. I recommend following the [aws cli setup](http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-set-up.html).

Once configured your credentials in the aws cli, and tested them, you are ready to follow the provision section below.

Make sure you have `godep` installed and `$GOPATH/bin` is a in your `$PATH`.

```
go get -u github.com/godep/godep
```

# building

Clone this project into your `$GOPATH`.

```
mkdir -p $GOPATH/src/github.com/wolfeidau
cd $GOPATH/src/github.com/wolfeidau
git clone https://github.com/wolfeidau/aws-iot-go
```

Run make to build and install in `$GOPATH/bin`.

```
make
```

# provision

To provision a new thing based on the preconfigured template.

```
iotprov create --type light --name kitchen_light
```

To create a certificate, policy and link it to the thing you just created, this will save the credentials in `[name].yml` in the current directory. For more information this process [Secure Communication Between a Thing and AWS IoT](https://docs.aws.amazon.com/iot/latest/developerguide/secure-communication.html).

```
iotprov certificate --name kitchen_light
```

To list things.

```
iotprov list --type light
```

Some things to note:

* Create is idemptotent as long as you have the matching type
* Currently defaults to us-west-2 as it is closest to Australia
* This will attempt to load the default AWS credentials you loaded when configuring the aws cli or you can export `AWS_PROFILE` to specify one.

# connect

To connect the iot device using the credentials you just generated.

{'fraction_non_alphanumeric': 0.09362168081029291, 'fraction_numerical': 0.0005474952094169176, 'mean_word_length': 4.182978723404255, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 7, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2156673', 'n_tokens_mistral': 1111, 'n_tokens_neox': 1068, 'n_words': 465}