Configuring and Setting up of AWS IOT button

image

AWS IOT Button is basically used by the developers in order to program based on Amazon Dash Button hardware. You need to connect to Wifi network in order to make the button work. I just got this button and thought to do something with it. So the first step that I need to do is create my AWS account. Once the account is created I can log into AWS IOT console.

One thing I found is that AWS IOT is not available in Canada (Central). Hence I have selected another region US East (Ohio). Here I am going to show you step by step instructions of how to setup the button.

Configuration

Step 1: In AWS IOT Console, select Registry => Things and then Register a thing

image

Using Register a thing, we are going to create a button. Provide the button name

image

You can associate a thing type from the optional configuration dropdown. However if there are no thing types, you can create one. In this case I am creating a thing type named IOTButton

image

Having done these steps, the thing gets created.

image

Step 2: Next step is to create the Policy for the device which is IAM policy which will state the security, resources that can act on with the button.

Select Policy from the console and create a new policy. You can use an existing policy also.

image

In Policy creation page, you can select the action types that you would like to perform. Here I am going to add two actions one is iot: Connect for Connecting the device to the gateway and the other one is iot: Publish for Publishing the button to specific topic.

image

For action = iot:Connect, I will update the resource URL to *.

For action = iot: Publish, I will update the resource URL to arn:aws:iot:us-east-2:597248753215:topic/iotbutton [which is the thing type we have created]/[DSN Id present at the back of your device]

You can view and edit the policy that got created.

arn:aws:iot:us-east-2:597248753215:policy/IOTButton1Policy

   1: {

   2:   "Version": "2012-10-17",

   3:   "Statement": [

   4:     {

   5:       "Effect": "Allow",

   6:       "Action": "iot:Connect",

   7:       "Resource": "*"

   8:     },

   9:     {

  10:       "Effect": "Allow",

  11:       "Action": "iot:Publish",

  12:       "Resource": "arn:aws:iot:us-east-2:597248753215:topic/iotbutton/[device-id]"

  13:     }

  14:   ]

  15: }

Step 3: Next step is to create a certificate for the device since in order to connect to IOT gateway we need a certificate and a key pair.

Let’s create a certificate

image

image

Download the certificates and later on we will upload those certificates to the button

image

Step 4: Activate the certificate. Once done, we need to select the certificate and associate it with the thing for the button.

image

image

Associating the certificate will add identity to the button.

image

Now attach the created policy to assign some permissions to the identity

image

image

Now we have the thing which has the certificate and policy attached to it. Now we should be able to configure the device and send MQTT messages to the gateway.

Step 5: Now to configure the button you need to press the button for 5 seconds. You should see the button blinking.

 

image

The password should be the last 8 characters from the DSN id at the back side of the button

Use 192.168.0.1 to configure the button.

image

Upload the certificate

image

Upload the private key

image

Enter the IOT endpoint which you can get from IOT Console => Settings.

image

Select the endpoint region. In my case it is us-east-1.

image

image

Step 6: Now since the device is configured, now if we push the button, we should be able to see the messages. So let’s dive down how we can see the messages.

Here for testing purpose we can go to the Test console of AWS IOT console.

image

Then subscribe to the topic. The URL here should be Topic name/full serial number of the button.

image

image

Exception: One of the issue I was facing was that the device was not able to communicate to the gateway since during the configuration, I have tried to use the access point of my mobile. I just went ahead and re-configured with Step 5, made the access point as my home wifi and also the endpoint region to us-east-2 even though the region was not displaying in the drop down.

You can see the exception in the IOT console.

image

image

Once I did the changes, I went ahead and pressed the button once. It blinked for few times and then displayed a green light which shows the communication was successful and message had been sent.

image

TESTING:

You can test different types of click events for the button.

Message for 1-click:

image

Message for 2-clicks:

image

Message for long-press like (2 Seconds):

image

You can also use another testing tool called MQTT.fx which is pretty easy and can be used for demo purpose as you don’t necessarily required to log into IOT console. Check out this post of how you can connect to MQTT.fx to AWS IOT

Using Open Live Writer for writing blogs

Writing blog has always been one of my favorite hobby. I had been using Windows Live Writer for posting my ideas, thoughts and sharing my experience to the outside world. Recently I came around with another writer called Open Live Writer which can also be used for writing blogs. It is almost similar to Windows Live Writer. As a coder and blogger, I would like to share my experience of how you can get this writer and how you can embed your code snippet to your post.

The writer can be downloaded from the location. Once you download the writer, you will be asked to configure it to connect to your blog account. In my case I am using WordPress as my blog account. Once you have installed the writer, you need download the Source Code Snippet plugin from the following location. Thanks to the following link https://richhewlett.com/wlwsourcecodeplugin/live-writer-plugin-download/ from where I got the instruction of downloading the plugin and configuring it. Once you download the plugin, you need to unzip the plugin folder and copy the contents to any of your local directory folder.

image

Now you need to open your registry and follow the path HKEY_CURRENT_USER\Software\OpenLiveWriter\PluginAssemblies where you need to add a Key: SyntaxHighlight_WordPressCom_OLWPlugIn_V2.0.0 and Value: C:\OLWPlugin\SyntaxHighlight_WordPressCom_OLWPlugIn.dll. The value will be the folder path where the plugin files resides.

image

Next open the configuration file OpenLiveWriter.exe.config from the following location C:\Users\UserName\AppData\Local\OpenLiveWriter\app-0.6.2 and update the configuration file by adding <loadFromRemoteSources enabled=”true” /> at the runtime section.

image Once you complete this process, close the writer and reopen it. You will be able to view the Source Code Snippet plugin in the writer utility.

image

Hope this helps to all my fellow bloggers.

OctoWatch–a mobile app to monitor Octopus deployments

Check out the new open source native app that helps you to keep track of state of Octopus deployments on your machines. Here is the link to iTune for this app. This app has been build with React Native and TypeScript.

Here is the GitHub Url for the source code to OctoWatch https://github.com/OctopusDeploy/OctoWatch. Note that is only an iOS app.

Access Team City from Windows VM deployed in Azure through Public IP

There might be a situation where you are planning to have your DevOps Continuous Integration and Deployment processes to be implemented from a VM having Windows OS you have provisioned in Azure. This post mainly emphasize on how you can access your Team City from one of the VM commissioned in Azure through Public IP. Since I am not dealing with how to setup the Team City, hence I will skip the setup process and rather focus on the access over public IP. Please go through the step-by-step instructions.

Step 1: Add Inbound rules to the server firewall for allowing communications

Login to the VM and then access the Windows Firewall . Create a new Inbound rule.

image

Select Protocol and Ports and specify port 80 where the rule applies. The port 80 is the port that has been configured for your localhost when you had setup Team City which goes like http://localhost/login.html. You can assign any other port that you had configured with.

image

image

Select Allow Connection from the Action pane

image

Rest continue with the default option for the Profile and then provide a name for this Rule you have created and finish to add the new rule.

Step 2: Configure the Azure VM from the Azure Portal

Login to the portal and select the VM that you have created and select the IP address.

image

Provide a DNS name and assign to Static IP

image

Select the Network Security Group <VM_Name>.nsg assigned for the VM in order to allow traffic for port 80. Select the Inbound Security Rules and Add a rule.

image

While adding the rule, add the name of the rule, ensure that you have selected HTTP for Service and Action is Allow.

image

Once the rule is added, Redeploy the VM.

image

That’s it. Now you can provide the Team City URL http://<dns-name>/login.html and you will be able to view the Team City Login page through Internet.

Global Azure Boot Camp 2017, Austin TX

Here are some of the boot camp session and training videos from Global Azure Boot Camp 2017 that was held in Austin, Texas.  Thanks to my friend Shawn Weisfeld @Technical Evangelist at Microsoft who had helped me to organize this boot camp at Microsoft campus along with an awesome setup of streaming and recording this videos at UserGroup.tv. Shawn is the founder of UserGroup.tv.

Also my sincere thanks and gratitude to our local sponsors and contributor Clear Measure, Austin .NET User Group and my organization Sogeti USA LLC for helping me organize this event with eminent speakers, foods and beverages along with Microsoft global organizers.

Mostly I am thankful to the following eminent speakers and contributors for this boot camp

2017 Austin Global Azure Boot Camp Welcome Note

//player.vimeo.com/video/215095604

 

Azure Foundation

//player.vimeo.com/video/215097953

 

Making the Case for the ServiceBus

//player.vimeo.com/video/215098024

 

Making Teams Fly with Continuous Delivery to Azure

//player.vimeo.com/video/215094826

 

Introduction to Azure Security Center

//player.vimeo.com/video/215094742

 

Building Powerful intelligence using Cognitive Services

//player.vimeo.com/video/215095364

 

Big Data in Azure

//player.vimeo.com/video/215103496

 

2017 Austin Global Azure Bootcamp Closing Note

//player.vimeo.com/video/215102088

 

Enjoy the videos and happy Azure Learning

Build and Deploy Web Application and Web API as Azure Web App through VSO Continuous Integration

I thought to write this post which might help my fellow developers to know how to create a CI build for any web application or web API through Team Services of VSO. Just like in one of the post I have explained how we can create a NuGet package using CI build, this post might give more insight about building and deploying an web application directly to Azure using CI build. Let’s get through the steps involved.

Step 1: Install and configure Azure PowerShell

This step is highly important if you don’t have Azure PowerShell installed. The cmdlets of Azure PowerShell can be used to create/configure cloud apps/services, VM, virtual networks, etc. Download an install Azure PowerShell from this link.

Once installed open Windows PowerShell in administrative mode and run the following Azure PowerShell cmdlets to get details of your Azure subscription and resources available. Main that you need is your Subscription Name and Subscription Id.

Command to get Azure Account Information: Login-AzureRmAccount

image

Command to get Azure Resources available: Get-AzureRmResource

Command to get the Subscription Name and Id: Get-AzureRmSubscription

Command to get the Azure Publish Settings File: Get-AzurePublishSettingsFile

This command is important to get profile settings for publishing your web app in Azure. This will download the publish settings file along with the credentials in your local box.

SNAGHTML1b92cac

Step 2: Create New Service Endpoint in Team Services dashboard

This step will help us to register or add our Azure subscription to TFS. This is done only once and at collection level using the Service tab. Just select New Service Endpoint and select Azure Classic.

 

In Add New Azure Classic Connection choose Subscription Id and Subscription Name that you got from Azure Command Get-AzureRmSubscription. The Connection Name can be based on your preferred one. You can even open the downloaded Publish Settings file to get the Subscription Id and Subscription Name. Also from the file, copy the content of Management Certificate and paste it in place holder as shown below while creating the new Connection.

 

Now this service endpoint is ready to be used while publishing the azure web app.

Step 3: Configure the Build and Deployment properties of Team Project

Create the build definition file for the team project for which you want to instantiate the CI build at every check in process to source control. For that select Azure WebApp from the Deployment tab of Build Definition window.

 

As usual in Build definition created, update your Mapping information to point to source control repository of your solution in Repository Tab. Update your CI filter in Trigger tab to point to source control repository of your solution.

Next lets select the Build tab and select Azure Deployment. In details section, you need to select the new service endpoint created and select the Web App Name.

 

That’s all we need. Now you can queue the build to see how it works.