Adding AWS IoT keys into Enebular

In this blog post, we are going to learn how to deploy flows using enebular.com on enebular-runtime-agents.

Installed **enebular-runtime-agent** on the device you want to deploy the flow? If no, quickly install it using the link, https://qiita.com/BSatyaKishore/items/3ee6cf9d5ad89310855d

**STEP 1:** Setting up on enebular.com
- Goto enebular.com. And sign in or sign up if needed and then sign in. <img width="602" alt="Screen Shot 2018-02-16 at 10.55.43.png" src="https://qiita-image-store.s3.amazonaws.com/0/222933/61707a96-c79a-dc1e-5d8a-7a0880aecc17.png">
- You'll see something similar to this. <img width="1436" alt="Screen Shot 2018-02-16 at 10.56.38.png" src="https://qiita-image-store.s3.amazonaws.com/0/222933/8c82913c-e332-4e34-1e4b-b562d641b4be.png">
- Then click on **Projects**. You'll see something similar to this. <img width="1311" alt="Screen Shot 2018-02-16 at 10.58.21.png" src="https://qiita-image-store.s3.amazonaws.com/0/222933/c572330a-317d-d387-a676-f12ba64d592a.png">
- Click on **Create Project**. And enter the name of your project. You'll see something similar to this. <img width="1270" alt="Screen Shot 2018-02-16 at 10.58.33.png" src="https://qiita-image-store.s3.amazonaws.com/0/222933/cef4bd83-b85b-b914-68ba-5548a86dab82.png">
- Click on **Submit**. Something like below should appear.  <img width="1437" alt="Screen Shot 2018-02-16 at 10.59.06.png" src="https://qiita-image-store.s3.amazonaws.com/0/222933/4ab53efc-18d2-cf8f-e8e2-2469321cd54b.png">
- Click on **Flow** in the left panel. <img width="1437" alt="Screen Shot 2018-02-16 at 10.59.06.png" src="https://qiita-image-store.s3.amazonaws.com/0/222933/11572590-6518-f46b-8543-702664216b65.png">
- Click on **+** in the bottom right**. You should see something like this. Fill out that pop-up. And click **Continue** <img width="1437" alt="Screen Shot 2018-02-16 at 10.59.27.png" src="https://qiita-image-store.s3.amazonaws.com/0/222933/ee35157d-2492-2cf1-e652-ff1ac9201244.png">
- You should see something similar to this. <img width="1440" alt="Screen Shot 2018-02-16 at 11.00.09.png" src="https://qiita-image-store.s3.amazonaws.com/0/222933/8e464cec-784d-035e-dcdf-2d20f51bb0ec.png">

**STEP-2:** Creating a flow on enebular.

- Click on **Edit Flow**. A new tab should open and you should see something similar to this.
<img width="1440" alt="Screen Shot 2018-02-16 at 11.00.37.png" src="https://qiita-image-store.s3.amazonaws.com/0/222933/b847716a-8819-abe2-cb04-6180a90e11b2.png">
- Use the **nodes** in the left panel to create flows. As an example, I created a simple flow as below. <img width="1440" alt="Screen Shot 2018-02-16 at 11.00.59.png" src="https://qiita-image-store.s3.amazonaws.com/0/222933/1f152e36-9b8a-9cee-8149-abe53075cfda.png">
- The **Deploy** button on the top right appears red. It means there are unsaved changes in the flow. Click on this **Deploy** button. It should change it's color to grey, which means all changes are saved on enebular.com <img width="1440" alt="Screen Shot 2018-02-16 at 11.01.09.png" src="https://qiita-image-store.s3.amazonaws.com/0/222933/a07d8fb4-56a3-9b72-3540-7261580b7a54.png">
- Now, close this tab and go to the tab from where you got here. **Refresh** it. You should some text in the grey area. <img width="1440" alt="Screen Shot 2018-02-16 at 11.01.22.png" src="https://qiita-image-store.s3.amazonaws.com/0/222933/683c211c-9358-8c8b-d1f4-252a532c71c3.png">

**STEP-3:** Getting Deploy Keys from AWS-IoT
- Open IAM console on amazon AWS. <img width="982" alt="Screen Shot 2018-02-16 at 10.42.14.png" src="https://qiita-image-store.s3.amazonaws.com/0/222933/722fb684-8115-0d3d-d751-79af9b0b1f42.png">
- In the left panel click on **Users**. You should see something like this. <img width="1055" alt="Screen Shot 2018-02-16 at 10.45.50.png" src="https://qiita-image-store.s3.amazonaws.com/0/222933/2935ccdb-407f-651c-e160-4323ef0c6a35.png">
- Click on **Add User** <img width="1121" alt="Screen Shot 2018-02-16 at 10.46.09.png" src="https://qiita-image-store.s3.amazonaws.com/0/222933/6634ce63-869c-9f81-0f1c-e3a23ea2c49c.png">
- You should see something like this. Fill with a **User name** and make sure that Access type* is set to **Programmatic access**. And Click on **Next: Permissions**. <img width="1402" alt="Screen Shot 2018-02-16 at 10.46.29.png" src="https://qiita-image-store.s3.amazonaws.com/0/222933/8b4db397-ab9e-aa20-0a37-615b683871ac.png">
- It should appear something like this, Click on **Attach existing policies directly** <img width="1368" alt="Screen Shot 2018-02-16 at 10.47.01.png" src="https://qiita-image-store.s3.amazonaws.com/0/222933/204d0ca8-28d7-b7c2-c4b2-b5eefec1fcae.png">
- In the search bar, search for **AWSIoTFullAccess** select it. <img width="1390" alt="Screen Shot 2018-02-16 at 10.47.17.png" src="https://qiita-image-store.s3.amazonaws.com/0/222933/74d76f4d-063c-c648-205f-d3a2f86f455c.png">
- Click on **Next: Review**<img width="1440" alt="Screen Shot 2018-02-16 at 10.47.33.png" src="https://qiita-image-store.s3.amazonaws.com/0/222933/f6ac98f8-9dbd-47da-819d-8bd03189b45b.png">
- Click on **Create User**. <img width="1440" alt="Screen Shot 2018-02-16 at 10.47.44.png" src="https://qiita-image-store.s3.amazonaws.com/0/222933/59ed90c6-21f3-9aa5-553b-c2110df069a3.png">
- You should see something like this. Copy these keys.  And save it for further usage in adding devices on enebular.com. <img width="1440" alt="Screen Shot 2018-02-16 at 10.48.29.png" src="https://qiita-image-store.s3.amazonaws.com/0/222933/26f6320e-72f3-bb42-24fe-fa3d7b0334fd.png">
- Copy those keys and end-point url which we got in the https://qiita.com/BSatyaKishore/items/3ee6cf9d5ad89310855d.

**STEP-4:** Adding these keys on enebular.com

- You were here. Click on **Deploy** on the top panel. 
<img width="1440" alt="Screen Shot 2018-02-16 at 11.01.22.png" src="https://qiita-image-store.s3.amazonaws.com/0/222933/ba983b99-c2b6-4d2f-4b46-f566a25d908f.png">
- You should see something similar to this. Click on **Deploy** button on the right. <img width="1440" alt="Screen Shot 2018-02-16 at 11.01.31.png" src="https://qiita-image-store.s3.amazonaws.com/0/222933/3a28cb02-623e-e8be-f83b-ac9ec35ebbc8.png">
- You should see thing like this. Select **AWS IoT** in the connection type.<img width="1440" alt="Screen Shot 2018-02-16 at 11.43.07.png" src="https://qiita-image-store.s3.amazonaws.com/0/222933/c0cbea01-997a-e5c1-1ee2-1388acbd3533.png">
- You should see something like these. Click on **New**<img width="628" alt="Screen Shot 2018-02-16 at 11.43.23.png" src="https://qiita-image-store.s3.amazonaws.com/0/222933/e3cd4b3e-6cce-4020-fde8-7be088f9db0f.png">
- Fill the details which we obtained using **STEP-3**. Region is available on AWS IoT EndPoint URL between 'iot.' and 'amazonaws'. Fill it and click on **Save**<img width="1440" alt="Screen Shot 2018-02-16 at 11.45.12.png" src="https://qiita-image-store.s3.amazonaws.com/0/222933/449557fd-9cb4-c4f5-e0e9-3c714a86c8f2.png">
- You should see all your things like this. <img width="776" alt="Screen Shot 2018-02-16 at 11.45.52.png" src="https://qiita-image-store.s3.amazonaws.com/0/222933/d7bde7b6-0112-f944-ad7c-603d7ebb0df7.png">
- Select **Test** and click **Deploy**. You should see something like this. And your flow will be deployed on the device. **Congratulations** <img width="645" alt="Screen Shot 2018-02-16 at 11.54.54.png" src="https://qiita-image-store.s3.amazonaws.com/0/222933/040b7859-ea0c-12ed-1af7-59481333fb46.png">

**STEP-MISC:** Deploying after setting up.
- Your Deploy screen should appear like this after you setup. Click on **Deploy** button. <img width="1440" alt="Screen Shot 2018-02-16 at 11.55.06.png" src="https://qiita-image-store.s3.amazonaws.com/0/222933/b1d898cb-a25e-6fc2-320b-06ebcd8dd1e6.png">
- Something like this will appear. Select AWS Iot. <img width="766" alt="Screen Shot 2018-02-16 at 11.46.09.png" src="https://qiita-image-store.s3.amazonaws.com/0/222933/af2b55f2-f412-9f14-9c91-a4e9e608ac28.png">
- Wait for a moment. You should be able to select your connection in the new list.
 <img width="776" alt="Screen Shot 2018-02-16 at 11.45.52.png" src="https://qiita-image-store.s3.amazonaws.com/0/222933/dd84bea5-d378-3921-b9ca-e00dee248387.png">
- Select your thing and click **Deploy**. You flow will be deployed on your thing. <img width="644" alt="Screen Shot 2018-02-16 at 11.54.42.png" src="https://qiita-image-store.s3.amazonaws.com/0/222933/28a510fe-2207-271b-3c0a-ddda62c44636.png">