Sunday, October 15, 2023
HomeIoTEnabling system upkeep throughout a number of time zones utilizing AWS IoT...

Enabling system upkeep throughout a number of time zones utilizing AWS IoT Jobs


Introduction

A advantage of Web of issues (IoT) expertise is the flexibility to attach your units to the cloud and simply entry them from around the globe. Whereas this profit has unlocked many alternatives, it has additionally has created a significant problem of conserving units up to date. Managing and sustaining a fleet of IoT units unfold throughout a number of geographies and time zones is logistically tough. To assist resolve this problem, AWS IoT Jobs gives the flexibility to programmatically schedule over-the-air (OTA) updates for a worldwide fleet of units, throughout time zones, and schedule a time-window for these updates.

With the brand new recurring upkeep window schedule configuration characteristic, now you can schedule AWS IoT Jobs to solely run within the precise time zone a tool is deployed in, inside a particular timeframe. For instance, let’s say you have got units in factories internationally that have to obtain a weekly OTA replace, however solely when the factories are closed on Saturdays, from 9PM to 6AM. Utilizing a mix of AWS IoT Jobs, dynamic factor teams, and AWS IoT System Shadow, you may group units collectively by the point zone they report they’re in and implement a weekly OTA replace to solely be utilized between 9PM and 6AM system native time on Saturdays.

On this weblog publish, we’ll element what steps to take to completely create and allow an OTA replace scheduling resolution utilizing AWS IoT Jobs, dynamic factor teams, and System Shadows.

Conditions

To observe by means of this weblog publish, you’ll need:

  1. An AWS account
  2. Entry to an AWS IoT Core supported area
  3. Entry to an AWS IoT System Administration supported area
  4. Entry to AWS CloudShell

Walkthrough

For the demonstration on this publish, you’ll schedule a weekly OTA replace that may solely run between 9PM and 6AM system native time. To do that, you’ll create two AWS IoT dynamic factor teams, one for Central Normal Time (CST) and one for Pacific Normal Time (PST), that can every be robotically populated with units based on their time zone. A tool’s time zone will probably be reported by their corresponding AWS IoT System Shadow. You’ll then create and configure two AWS IoT Jobs, one for every dynamic factor group. Every job may have a schedule configuration with the upkeep window set to reoccur weekly from 9PM to 6AM. The illustration under particulars what this resolution will seem like as soon as totally carried out.

A diagram that shows two devices being added to two separate AWS IoT dynamic thing groups, with two separate AWS IoT Jobs running on each device according to the timezone they're in.

Step 1: Create AWS IoT dynamic factor teams

To create your AWS IoT dynamic factor teams (AWS CloudShell, AWS CLI):

  1. Allow AWS IoT System Administration fleet indexing by issuing the update-indexing-configuration command
  2. Create the AWS IoT dynamic factor group for units within the PST time zone by issuing the create-dynamic-thing-group command
    aws iot create-dynamic-thing-group --thing-group-name "pstdevices" --query-string "shadow.reported.timezone:PST"
  3. Create the AWS IoT dynamic factor group for units within the CST time zone by issuing the create-dynamic-thing-group command
    aws iot create-dynamic-thing-group --thing-group-name "cstdevices" --query-string "shadow.reported.timezone:CST"

Step 2: Configure system time zones

To configure your system’s time zones (AWS CloudShell, AWS CLI):

  1. Create an AWS IoT factor for the system deployed within the PST time zone by issuing the create-thing command
    aws iot create-thing --thing-name "vibrationdevicepsttimezone"
  2. Create an AWS IoT factor for the system deployed within the CST time zone by issuing the create-thing command
    aws iot create-thing --thing-name "vibrationdevicecsttimezone"
  3. Create an AWS IoT System Shadow for the system deployed within the PST time zone by issuing the update-thing-shadow command
    aws iot-data update-thing-shadow --cli-binary-format raw-in-base64-out --thing-name vibrationdevicepsttimezone --payload '{"state":{"reported":{"timezone":"PST"}}}' "vibrationdevicepsttimezone.txt"
  4. Create an AWS IoT System Shadow for the system deployed within the CST time zone by issuing the update-thing-shadow command
    aws iot-data update-thing-shadow --cli-binary-format raw-in-base64-out --thing-name vibrationdevicecsttimezone --payload '{"state":{"reported":{"timezone":"CST"}}}' "vibrationdevicecsttimezone.txt"
  5. Confirm that the AWS IoT factor for the system deployed within the PST time zone was added to the pstdevices AWS IoT dynamic group by issuing the list-thing-groups-for-thing command
    aws iot list-thing-groups-for-thing --thing-name vibrationdevicepsttimezone

    The output from the command ought to look just like the next:

    {
        "thingGroups": [
            {
                "groupName": "pstdevices",
                "groupArn": "arn:aws:iot:us-east-1:<AWSACCOUNTID>:thinggroup/pstdevices"
            }
        ]
    }
  6. Confirm that the AWS IoT factor for the system deployed within the CST time zone was added to the cstdevices AWS IoT dynamic group by issuing the list-thing-groups-for-thing command
    aws iot list-thing-groups-for-thing --thing-name vibrationdevicecsttimezone

    The output from the command ought to look just like the next:

    {
        "thingGroups": [
            {
                "groupName": "cstdevices",
                "groupArn": "arn:aws:iot:us-east-1:<AWSACCOUNTID>:thinggroup/cstdevices"
            }
        ]
    }

Step 3: Create AWS IoT Jobs

To create your AWS IoT Jobs (console):

    1. Open the AWS IoT console
    2. On the left-hand navigation bar, underneath Handle, Distant Actions, select Jobs
    3. Select Create Job
    4. Choose Create customized job
    5. Enter a job title of pstdevicesiotjob
    6. For Factor teams to run this job, select pstdevices
    7. Select the Job template you want to use for this demonstration
    8. Select Subsequent
    9. For Job run Kind, choose Steady
    10. Below Further configurations, select Scheduling configuration
    11. For Job begin, enter in the present day’s date and a time one hour forward of your present time
    12. For Recurring upkeep window, choose Weekly
    13. For On these weekdays, choose Saturday
    14. For Upkeep window begins from, enter a time of 21:00 (9:00PM in 24-hour format)
    15. For Upkeep window length, enter 9 hours and 0 minutes (ending job executions at 6:00AM)
      Your console must be just like the next screenshot:A screenshot of the AWS IoT Console where Scheduling configuration parameter Job start is set to today's date, one hour ahead, Recurring maintenance window is set to Weekly, On these weekdays is set to Saturday, Maintenance window starts from is set to 21:00, and Maintenance window duration is set to 9 hours and 0 minutes.
    16. Select Submit
    17. Repeat steps 2 by means of 15 utilizing the next:
      • Set job title to cstdevicesiotjob
      • Set Factor teams to run this job to cstdevices
      • Select the identical Job template you utilized in step 7
      • Select Submit
    18. Below Standing, guarantee each jobs are displaying as Scheduled
      Your console must be just like the next screenshot:

A screenshot of the AWS IoT Console where the AWS IoT Job is showing a status of Scheduled.

The standing of every job will change to In progress after your configured Upkeep window begins from date and time passes. Every job will then begin a job execution on each system throughout the focused AWS IoT dynamic factor group at 9PM system native time on Saturday and finish job executions at 6AM on Sunday. These job executions will happen on each present and newly added system till the Upkeep window length time has handed. As soon as the Upkeep window length time has handed, the standing of every job will change again to Scheduled. This course of will happen weekly till you cancel every job.

Cleansing Up

Make sure you take away the sources created on this weblog to keep away from expenses.
Out of your AWS CloudShell setting problem the next instructions:

  1. aws iot delete-thing —thing-name "vibrationdevicepsttimezone"
  2. aws iot delete-thing —thing-name "vibrationdevicecsttimezone"
  3. aws iot delete-job --job-id "pstdevicesiotjob"
  4. aws iot delete-job --job-id "cstdevicesiotjob"
  5. aws iot delete-dynamic-thing-group --thing-group-name "pstdevices"
  6. aws iot delete-dynamic-thing-group --thing-group-name "cstdevices"
  7. aws iot update-indexing-configuration --thing-indexing-configuration thingIndexingMode=OFF

Conclusion

On this publish you realized tips on how to deploy an OTA replace inside an accredited timeframe to a fleet of units which can be deployed throughout a number of time zones utilizing AWS IoT Jobs, dynamic factor teams, and System Shadows. Utilizing this method, you may remotely deploy updates to your fleet of units, and get the peace of thoughts that every system will begin the replace on the right time and apply it solely throughout your sanctioned time window. For a extra in depth take a look at AWS IoT Jobs, take a look at our Get Began with AWS IoT workshop and this weblog publish on tips on how to Schedule distant operations utilizing AWS IoT System Administration Jobs.

Writer bio

Nicholas Switzer is an IoT Specialist Options Architect at Amazon Net Providers. He joined AWS in 2022 and makes a speciality of IoT and Edge Computing and the related product house. He’s based mostly within the US and enjoys constructing good merchandise that enhance on a regular basis life.



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments