Category Archives: Cloud

Web service call with Azure Sphere and curl

libcurl library is included in the Azure Sphere SDK. For IoT applications web service calls are almost a pre-requisite to connect everyday objects to the Internet. Being able to invoke web service as convenient as the Azure Sphere is definitely an advantage.

Sample application is available at git hub. Open with Visual Studio the HTTPS_Curl_Easy solution. This project defaults to open To change to the web service desired, first update the app_manifest.json file for the allowed host.

"SchemaVersion": 1,
"Name": "HTTPS_Curl_Easy",
"ComponentId": "20191001-0000-0000-0000-000000000000",
"EntryPoint": "/bin/app",
"CmdArgs": [],
"Capabilities": {
"AllowedConnections": [ "", "" ]
"ApplicationType": "Default"

Then open the main.c file and point the Azure Sphere to the Internet.

 if ((res = curl_easy_setopt(curlHandle, CURLOPT_URL, "")) != CURLE_OK) {
LogCurlError("curl_easy_setopt CURLOPT_URL", res);
goto cleanupLabel;

Check the log from web server.



Re-mounting an AWS EBS Volume to another instance

This is handy for a lot of reasons, like rescuing disk data or fixing boot configuration. The detail is here at the Amazon documentation. The outline of steps is below:

  1. Stop the original instance.
  2. Detach the volume from the stopped instance.
  3. Create a new instance of similar type to the original instance and assign the same security group.
  4. Start the new instance.
  5. Attach the detached original volume to the new instance as /dev/xvdf
  6. Login to the new instance, create mount point and mount the original volume.
  7. Once completed, umount the original volume and detach from the new instance.
  8. Attach the original volume to the original instance as /dev/sda1
  9. Start the original instance.

Essential commands for this, based on Ubuntu. Some steps above are done in the AWS Console GUI.

ubuntu:~$ lsblk
 xvda 202:0 0 8G 0 disk
xvda1 202:1 0 8G 0 part /
 xvdf 202:80 0 10G 0 disk
xvdf1 202:81 0 10G 0 part
ubuntu:~$ sudo file -s /dev/xvdf
 /dev/xvdf: x86 boot sector
ubuntu:~$ sudo mkdir /rescue
ubuntu:~$ sudo mount /dev/xvdf1 /rescue