Giter VIP home page Giter VIP logo

aws-iot-analytics-sample-cdk's Introduction

aws-iot-analytics-sample-cdk

AWS IoT Analytics の各リソースを CDK で構築するサンプルです

Environment

$ sw_vers
ProductName:	Mac OS X
ProductVersion:	10.15.7
BuildVersion:	19H2

$ aws --version
aws-cli/2.0.28 Python/3.7.4 Darwin/19.6.0 botocore/2.0.0dev32

$ cdk --version
1.70.0 (build c145314)

$ python3 --version
Python 3.8.5

$ pip3 --version
pip 20.1.1 from /usr/local/lib/python3.8/site-packages/pip (python 3.8)

Usage

Deploy

// 環境変数の設定 - AWS IoT Core で作った 1-Click 証明書を使用します
$ export AWS_IOT_CERTIFICATE_NAME="<証明書の名前>"

$ yarn install
$ yarn build

$ cdk bootstrap
$ cdk list
LambdaStack
IotAnalyticsStack
IotCoreStack
$ cdk deploy --context ioTCertificateName=${AWS_IOT_CERTIFICATE_NAME} IotCoreStack

Publish messages

$ export AWS_IOT_ENDPOINT="<カスタムエンドポイント>"
$ export AWS_IOT_CLIENT_ID="<モノの名前>"

// メッセージ送信
$ pip3 install -r requirements.txt
$ python3 publish_message.py

Connecting to hogehoge.iot.ap-northeast-1.amazonaws.com with client ID aws_iot_analytics_sample_iot_thing...
Connected!
Published: {"device": {"id": "device-1", "name": "hoge"}, "datetime": "2020-10-24 01:19:54", "temperature": 21} to the topic: iot/topic
Published: {"device": {"id": "device-1", "name": "hoge"}, "datetime": "2020-10-24 01:20:04", "temperature": 39} to the topic: iot/topic

...

Disconnected!

aws-iot-analytics-sample-cdk's People

Contributors

iam326 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.