Skip to main content

L2 CDK construct to provision AWS IoT Fleetwise

Project description

NPM version PyPI version release

cdk-aws-iotfleetwise

L2 CDK construct to provision AWS IoT Fleetwise

Install

Typescript

npm install cdk-aws-iotfleetwise

API Reference

Python

pip install cdk-aws-iotfleetwise

API Reference

Sample

    const database = new ts.CfnDatabase(this, 'Database', {
      databaseName: 'FleetWise',
    });

    const table = new ts.CfnTable(this, 'Table', {
      databaseName: 'FleetWise',
      tableName: 'FleetWise',
    });

    const role = new aim.Role(this, 'Role', {
      assumedBy: new aim.ServicePrincipal('iotfleetwise.amazonaws.com'),
      managedPolicies: [
        aim.ManagedPolicy.fromAwsManagedPolicyName('AdministratorAccess'),
      ],

    });

    const signalCatalog = new ifw.SignalCatalog(this, 'SignalCatalog', {
      database,
      table,
      role,
      nodes: [
        new ifw.SignalCatalogBranch('Vehicle', 'Vehicle'),
        new ifw.SignalCatalogSensor('EngineTorque', 'Vehicle.EngineTorque', 'DOUBLE'),
      ],
    });

    const model_a = new ifw.VehicleModel(this, 'ModelA', {
      signalCatalog,
      name: 'modelA',
      description: 'Model A vehicle',
      networkInterfaces: [new ifw.CanVehicleInterface('1', 'vcan0')],
      signals: [
        new ifw.CanVehicleSignal('EngineTorque', 'Vehicle.EngineTorque', '1',
          401, // messageId
          1.0, // factor
          true, // isBigEndian
          false, // isSigned
          8, // lenght
          0.0, // offset
          9), // startBit
      ],
    });

    const vin100 = new ifw.Vehicle(this, 'vin100', {
      vehicleId: 'vin100',
      vehicleModel: model_a,
      createIotThing: true
    });

    new ifw.Campaign(this, 'Campaign', {
      name: 'TimeBasedCampaign',
      target: vin100,
      collectionScheme: new ifw.TimeBasedCollectionScheme(cdk.Duration.seconds(10)),
      signals: [
        new ifw.CampaignSignal('Vehicle.EngineTorque'),
      ],
    });

Getting started

To deploy a simple end-to-end example you can use the following commands

yarn install
projen && projen build
npx cdk -a lib/integ.full.js deploy

The deploy takes about 15 mins mostly due to compilation of the IoT FleetWise agent in the EC2 instance that simulate the vehicle. Once deploy is finshed, approve the campaign with the command:

aws iotfleetwise update-campaign --campaign-name FwTimeBasedCampaign --action APPROVE

and data will start to show up in the Timestream table.

TODO

Warning: this construct should be considered at alpha stage and is not feature complete.

  • Reduce Lambda log retention to 1d
  • Apply the least priviledge principle to roles
  • Implement updates for all the custom resources
  • Fleet
  • Conditional campaigns

Security

See CONTRIBUTING for more information.

License

This code is licensed under the MIT-0 License. See the LICENSE file.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cdk-aws-iotfleetwise-0.0.10.tar.gz (16.8 MB view details)

Uploaded Source

Built Distribution

cdk_aws_iotfleetwise-0.0.10-py3-none-any.whl (16.8 MB view details)

Uploaded Python 3

File details

Details for the file cdk-aws-iotfleetwise-0.0.10.tar.gz.

File metadata

  • Download URL: cdk-aws-iotfleetwise-0.0.10.tar.gz
  • Upload date:
  • Size: 16.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for cdk-aws-iotfleetwise-0.0.10.tar.gz
Algorithm Hash digest
SHA256 d15cf6bd65ce1e962fb13da06dd63be4d577d81e46371f3c5949648b114dc20d
MD5 1e757107a9dfb0b6cba4df171f7107e1
BLAKE2b-256 3b22eb6b0cd19150f5e6fd97e6f617c356d703020405acc3e4a0cfe7bb32c5f8

See more details on using hashes here.

File details

Details for the file cdk_aws_iotfleetwise-0.0.10-py3-none-any.whl.

File metadata

File hashes

Hashes for cdk_aws_iotfleetwise-0.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 47114fa50cb74285cf5b1373973366d140312888ad45a94432c9f95768bd1777
MD5 d67794f901e29ca8eb100ad88c5c7e87
BLAKE2b-256 f8042b04d7dd735a0df95354af43ab1c17083f50c2a96f2cfc3a43cb91003b97

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page