Upload
others
View
20
Download
1
Embed Size (px)
Citation preview
How to deploy DSH-PREDMNTin proprietary AWS account
Agenda
1 Architecture
2 Configure and Deploy in your AWS account
2
Remove DSH-PREDMNT from your account3
Predictive Maintenance DashboardEnd to End architecture
3
Sensors/Actuators
IoT Node
Firmware
OpenSTlinux
Distribution
IoT Cloud Application User Dashboard
The Cloud Application collects data from IoT Node directly or from a Gateway
Predictive Maintenance Dashboard
Edge
AWS IoT Greengrass
4
SensorEdge node
AWS IoT
GreenGrass
Autonomous
sensor
Amazon
FreeRTOS
Data Acquisition Data Ingestion
IoT Core
Data Processing, Storage
and Services
Kinesis
DynamoDB
Dashboard
S3
CloudFront
Users
AWS Lambda
Simplified Architecture
ST IoT
Dashboard
API Gateway
5
Predictive Maintenance DashboardAWS services by class
AWS Lambda
Amazon DynamoDB
AWS IoT Core AWS IoT GreengrassAmazon CloudWatch AWS CloudFormation
Amazon API GatewayAmazon CloudFront
Amazon Cognito
AWS Identity and Access
Management (IAM)
AWS Shield
AWS WAF
Amazon Simple Storage
Service (S3)
User identify and securityApplication core modules:
IoT, Compute, Database and StorageManagement and Governance
Networking and Content Delivery
Kinesis
Predictive Maintenance DashboardHow can I access?
6
• dsh-predmnt.st.com
https://www.st.com/en/applications/factory-automation/condition-monitoring-predictive-
maintenance.html
ST.com/DSH-Predmnt
• Serverless deployment in
customer’s account
*regulated with terms of usage for free limited access
Configure and Deploy in proprietary account
Get the toolsTools required to install the project
• Account AWS
• NodeJS
• npm
• serverless
8Note: Please refer to the official tools instructions for installation.
To be able to run the automatic deploy the elements listed below are required.
Predictive Maintenance DashboardDeploy Application in own AWS account
9
• dsh-predmnt.st.com
ST.com/DSH-Predmnt
• Serverless deployment in
customer’s account
1. Accept License Agreement
2. Get the tools
3. Download .zip file
4. Configure
5. Deploy
Platforms Supported
Browser Required
Download the .zip filesWeb App project structure
• predictive_maintenance_fe
• lambda
• predictive_dashboard
• serverless
10
AWS Lambda lets you run
code without provisioning
or managing servers
This folder contains the
code of the Predictive
Maintenance DashboardThis is the main folder of
the Serverless project
Unzip the file in any folder of your file system and you will get the folders structure reported below.
ConfigureStep 1/3
11
https://serverless.com/framework/docs/providers/aws/guide/credentials/?rd=true
Official Serverless AWS credentials configuration instructions.
For more information about “Storing Credentials in the Config File” you can
check the aws official page:
https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html
• The Serverless Framework needs access
to your AWS cloud provider's account so
that it can create and manage resources
on your behalf.
In order to execute the automatic deploy the following configuration is required.
1
Follow the link below to allow serverless to deploy the Web App to AWS:
region: <aws_region>account_id: <aws_account_id>thingGroupName: <aws_iot_thingGroupName>polling_period: <iot_polling_period> # millisecondendpoint: <iot_core_endpoint>bucket_name:predictive-dashboard: <predictive-dashboard-bucket-name>predmnt-data-lake: <data-lake-bucket-name>weekly-lake: <weekly-lake-bucket-name>predmnt-zip-lake: <zip-lake-bucket-name>
env: <env>restricted_access: falseadmin_panel: falsesimulator_pool: falseSSO: falsezip_expiration: <zip-file-duration> # hoursTags:-
Key: "App-Name" # optional list of tagValue: “my-app-name"
12
• Once Serverless is configured, to
customize dashboards and AWS regions, you need to create a folder /config and
a file config.yml inside it.
predictive_maintenance_fe/serverless/config/config.yml
Replace the <text> with
the correct values.
• region: your AWS region where IoT Core service lives
• account_id: your AWS account id
• thingGroupName: IoT things group name
• polling_period: disconnection timeout (in seconds) after last data transmission of the IOT device
• endpoint: AWS IoT Core endpoint
• bucket_name:
• predictive-dashboard: name of your AWS bucket S3 containing web code
• predmnt-data-lake: name of your S3 bucket that will contain telemetry data
• weekly-lake: name of your S3 bucket that will contain aggregated data by week
• predmnt-zip-lake: name of your S3 bucket that will contain zip file to be downloaded
• env : environment name, if “dev” allowed_ip_range must be valorized with the allowed ip range
• zip_expiration: how many hours zip with telemetry data remain available to be downloaded
2 ConfigureStep 2/3
In order to execute the automatic deploy the following configuration is required.
.yml
!
It is not possible to have two or more buckets S3 with
same name. It is strongly recommended to compose this
name using a combination of region, account id and static
string as suffix.
ConfigureStep 3/3
13
npm install
• Before to start the deploy, you need to download from npm all the node modules requested.
• To do this execute the following command from a
terminal shell inside the serverless folder
If you want you can use the
abbreviation commandnpm i
Deploy 1/4
14
serverless deploy
• To start the automatic deploy procedure we need to
execute this command from a shell like prompt or
powershell within the folder predictive_dashboard_fe/serverless/
If you want a log more
verbose please use the options -–verbose.
Lambda
function
Amazon
DynamoDBAmazon S3
bucket
Deploy 2/4
15
C:\...\predictive_maintenance_fe\serverless\sls_invoke_params.env
• After that the command launched in the previously slide is done, it
is necessary to lunch a final command in order to trigger a
function that sets some configuration on our aws account.
• Open the file below using a text editor
1
Set these environmental variables on current command shell
Deploy 3/4
16
How to set Environmental variables
Microsoft Windows user
Unix / Mac user
Deploy 4/4
17
Launch the configuration command
C/.../predictive_maintenance_fe/serverless>serverless invoke --function ${PRDMNT_FUNC} --
region ${PRDMNT_REGION} --stage ${PRDMNT_STAGE} --data ${PRDMNT_DATA}
C:\...\predictive_maintenance_fe\serverless>serverless invoke --function $Env:PRDMNT_FUNC --
region $Env:PRDMNT_REGION --stage $Env:PRDMNT_STAGE --data $Env:PRDMNT_DATA
Register your user
18
Using the AWS web
console, edit the Cognito
service and add a new
user to the users pool
Fill the fields as reported
below with your new user
In the first login on the dashboard, you have to confirm the sign up procedure replacing the
temporary password with the final one.
Dashboard Link
19
Via AWS web console, go
to Cloudfront service
You will find the link to the
dashboard just deployed
associated with the bucket
name chosen during the
configuration procedure
Now you can work with DSH-PREDMNT
20
• User login and data segregation
• Assets Map
• Device and AWS Greengrass Edge
registration and configuration:
• Provisioning
• Association to assets
• Streaming time
• Live data visualization
• Add a device to live monitoring
• Asset Health Monitoring
• Collect data
• Analyse Historical trends
• Apply failure thresholds for alerts and warnings
• English and Chinese
Info Panel for the
user about its terms
Monitor live events or
check events history
Download telemetry data
sent filtering by device
Remove DSH-PREDMNT from your account
Remove main stack 1/2
22
serverless remove
• To remove the services and clear the entire
dashboard and AWS setup environment we execute
this serverless command within the folder predictive_dashboard_fe/serverless/
If you want a verbose log please use the options -–
verbose.
• Resources deletion is composed by two parts:
1. Main stack deletion
2. Additional stacks deletion
Remove additional stacks 2/2
23
serverless remove additionalstacks
• After this, additional stacks containing all Lambda
functions, IoT rules, policies, identity pools and S3
buckets are erased and a new deploy can be done
from scratch.
© STMicroelectronics - All rights reserved.
The STMicroelectronics corporate logo is a registered trademark of the STMicroelectronics
group of companies. All other names are the property of their respective owners.
Thank you