Skip to content

Latest commit

 

History

History
112 lines (53 loc) · 5.31 KB

File metadata and controls

112 lines (53 loc) · 5.31 KB

Set up Atlas Predictive Maintenance backend

Prerequisites

  • S3 bucket to which vehicle sensor data is exported.
    • Credentials (Access and Secret key) to upload to the above S3 bucket.

1. Set up the MongoDB Atlas Cluster

  1. Create a MongoDB Cloud user account and ensure that you have access to an organization/project.
  2. Under the Database tab, click "Build A Database" and create a free MongoDB cluster in your preferred region and name it fleet-db. You can choose a Free Tier (Shared), or a Dedicated cluster.

2. Set up App Services

  1. Install appservice-cli

  2. Generate API key, assign the Project Owner permission and add your IP address to the access list

  3. Login with your API key

    appservices login --api-key="<API-Key>" --private-api-key="<Private-Key>"

  4. Change the working directory to cd 1-atlas/app-services

  5. Import the IoT Greengrass Realm GenAI framework application appservices push --local ./ --remote GreenGrassTest and configure the options according to your needs. If you are unsure which options to choose, the default ones are usually a good way to start

sample configuration

image
After you've chosen your options, you should see the following appear: <br><br>

    App created successfully    
    ...    
    Successfully pushed app up: Your App ID 

Your App ID should be in the following format: YourAppName-XXXXX<br><br>

**Secret variables are not stored in the config for security reasons and will need to be manually created for the app service functions to work.**<br><br>
  1. Define and Access Secrets.

    First we create the secrets. We need to create 2 secrets, AWSAccessKeyId & AWSSecretAccessKey Fill in the values with your AWS credentials.

    appservices secrets create
    

    Screenshot of the appservice secret creation: AWSAccessKeyId

    image

    Screenshot of the appservice secret creation: AWSSecretAccessKey

    image

    These secrets are accessed from the function that uploads telemetry data to the S3 bucket. To do so we must Link 2 values AWSAccessKeyIdRef & AWSSecretAccessKeyRef and link each with the Secrets we created above.

    image
  2. Validate that the MongoDB Atlas cluster database and Application Service features are created successfully.

    Database:

    image

    Application Services:

    Functions:

    image

    Triggers:

    image

    HTTPS Endpoints:

    image

    Linked Data Sources:

    image
  3. Add aws-sdk depencency to the functions to allow the function to use aws sdk library which is used for exporting the sensor data to the s3 bucket.

    aws-sdk-lib

  4. Create a S3 bucket as "aws-iot-vehicle-telemetry" in the AWS Account.

image
  1. Congrats! The first part is done. Now you'll continue with setting up Edge Gateway and Vehicle Simulator "Part 2: Set up Edge Gateway and Vehicle Simulator".

Debugging

In case if you don't see the triggers workig as expected, check if it is enabled in the triggers section in App Services

Enable Trigger