Step 6: Deploy the Amazon Kinesis Video Streams Edge Agent Amazon IoT Greengrass component on the device - Amazon Kinesis Video Streams
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Step 6: Deploy the Amazon Kinesis Video Streams Edge Agent Amazon IoT Greengrass component on the device

Deploy the Amazon Kinesis Video Streams Edge Agent Amazon IoT Greengrass component on the device
  1. Download the tar file using the provided link.

    If you completed the Amazon Kinesis Video Streams Edge Agent interest form, check your email for the download link. If you haven't completed the form, complete it here.

  2. Verify the checksum.

  3. Extract the binaries and jar in your device.

    Type: tar -xvf kvs-edge-agent.tar.gz.

    After extraction, your folder structure will look like the following:

    kvs-edge-agent/LICENSE kvs-edge-agent/THIRD-PARTY-LICENSES kvs-edge-agent/pom.xml kvs-edge-agent/KvsEdgeComponent kvs-edge-agent/KvsEdgeComponent/recipes kvs-edge-agent/KvsEdgeComponent/recipes/recipe.yaml kvs-edge-agent/KvsEdgeComponent/artifacts kvs-edge-agent/KvsEdgeComponent/artifacts/aws.kinesisvideo.KvsEdgeComponent kvs-edge-agent/KvsEdgeComponent/artifacts/aws.kinesisvideo.KvsEdgeComponent/EdgeAgentVersion kvs-edge-agent/KvsEdgeComponent/artifacts/aws.kinesisvideo.KvsEdgeComponent/EdgeAgentVersion/edge_log_config kvs-edge-agent/KvsEdgeComponent/artifacts/aws.kinesisvideo.KvsEdgeComponent/EdgeAgentVersion/kvs-edge-agent.jar kvs-edge-agent/KvsEdgeComponent/artifacts/aws.kinesisvideo.KvsEdgeComponent/EdgeAgentVersion/libgstkvssink.so kvs-edge-agent/KvsEdgeComponent/artifacts/aws.kinesisvideo.KvsEdgeComponent/EdgeAgentVersion/libIngestorPipelineJNI.so kvs-edge-agent/KvsEdgeComponent/artifacts/aws.kinesisvideo.KvsEdgeComponent/EdgeAgentVersion/lib kvs-edge-agent/KvsEdgeComponent/artifacts/aws.kinesisvideo.KvsEdgeComponent/EdgeAgentVersion/lib/libcproducer.so kvs-edge-agent/KvsEdgeComponent/artifacts/aws.kinesisvideo.KvsEdgeComponent/EdgeAgentVersion/lib/libKinesisVideoProducer.so
    Note

    The release folder name should be set up in a way that reflects the latest binary release number. For example, a 1.0.0 release will have the folder name set as 1.0.0.

  4. Build the dependencies jar.

    Note

    The jar included with the kvs-edge-agent.tar.gz does not have the dependencies. Use the following steps to build those libraries.

    Navigate to the kvs-edge-agent folder that contains pom.xml.

    Type mvn clean package.

    This will generate a jar file containing the dependencies the Amazon Kinesis Video Streams Edge Agent requires at kvs-edge-agent/target/libs.jar.

  5. Place the libs.jar into the folder that contains the component’s artifacts.

    Type mv ./target/libs.jar ./KvsEdgeComponent/artifacts/aws.kinesisvideo.KvsEdgeComponent/EdgeAgentVersion/.

  6. Optional. Configure properties. The Amazon Kinesis Video Streams Edge Agent accepts the following environment variables in Amazon IoT Greengrass mode:

    Environment Variable Name Required Description

    AWS_REGION

    Yes

    The Region that is used.

    Example: us-west-2

    Amazon IoT Greengrass Core software automatically sets this value for you. For more information, see the Component environment variable reference topic in the Amazon IoT Greengrass Version 2 Developer Guide.

    GST_PLUGIN_PATH

    Yes

    File path pointing to the folder containing the gstkvssink and IngestorPipelineJNI platform-dependent libraries. This lets GStreamer load these plugins. For more information, see Download, Build, and Configure the GStreamer Element.

    Example: /download-location/kvs-edge-agent/KvsEdgeComponent/artifacts/aws.kinesisvideo.KvsEdgeComponent/EdgeAgentVersion/

    LD_LIBRARY_PATH

    Yes

    File path pointing to the directory containing the cproducer and KinesisVideoProducer platform-dependent libraries.

    Example: /download-location/kvs-edge-agent/KvsEdgeComponent/artifacts/aws.kinesisvideo.KvsEdgeComponent/EdgeAgentVersion/lib/

    AWS_KVS_EDGE_CLOUDWATCH_ENABLED

    No

    Determines if the Amazon Kinesis Video Streams Edge Agent will post job health metrics onto Amazon CloudWatch.

    Accepted values: TRUE/FALSE (case insensitive). Defaults to FALSE if not provided.

    Example: FALSE

    AWS_KVS_EDGE_LOG_LEVEL

    No

    The level of logging the Amazon Kinesis Video Streams Edge Agent outputs.

    Accepted values:

    • OFF

    • ALL

    • FATAL

    • ERROR

    • WARN

    • INFO, default, if not provided

    • DEBUG

    • TRACE

    Example: INFO

    AWS_KVS_EDGE_LOG_MAX_FILE_SIZE

    No

    Once the log file reaches this size, a rollover will occur.

    • Min: 1

    • Max: 100

    • Default: 20, if not provided

    • Units: Megabytes (MB)

    Example: 5

    AWS_KVS_EDGE_LOG_OUTPUT_DIRECTORY

    No

    The file path pointing to the directory where the Amazon Kinesis Video Streams Edge Agent logs are output. Defaults to ./log if not provided.

    Example: /file/path/

    AWS_KVS_EDGE_LOG_ROLLOVER_COUNT

    No

    The number of rolled-over logs to keep before deleting.

    • Min: 1

    • Max: 100

    • Default: 10, if not provided

    Example: 20

    AWS_KVS_EDGE_RECORDING_DIRECTORY

    No

    File path pointing to the directory recorded media will be written to. Defaults to the current directory if not provided.

    Example: /file/path/

    GREENGRASS_ROOT_DIRECTORY

    No

    The file path to the Amazon IoT Greengrass root directory.

    This defaults to /greengrass/v2/ if not provided.

    Example: /file/path/

    GST_DEBUG

    No

    Specifies the level of GStreamer logs to output. For more information, see the GStreamer documentation.

    Example: 0

    GST_DEBUG_FILE

    No

    Specifies the output file of the GStreamer debug logs. If unset, debug logs get output to standard error. For more information, see the GStreamer documentation.

    Example: /tmp/gstreamer-logging.log

    Open kvs-edge-agent/KvsEdgeComponent/recipes/recipe.yaml and modify the run script to add any of the preceding environment variables.

    Important

    Make sure that the modified run script doesn't contain any tab characters. The Amazon IoT Greengrass core software won't be able to read the recipe.

  7. Deploy the Amazon Kinesis Video Streams Edge Agent Amazon IoT Greengrass component.

    Type:

    sudo /greengrass/v2/bin/greengrass-cli deployment create \ --recipeDir <download location>/kvs-edge-agent/KvsEdgeComponent/recipes/ \ --artifactDir <download location>/kvs-edge-agent/KvsEdgeComponent/artifacts/ \ --merge "aws.kinesisvideo.KvsEdgeComponent=EdgeAgentVersion"

    For additional information, see the following sections in the Amazon IoT Greengrass Version 2 Developer Guide:

  8. Send configurations to the application using the Amazon CLI.

    1. Create a new file, example-edge-configuration.json.

      Paste the following code into the file. This is a sample configuration that records daily from 9:00:00 AM to 4:59:59 PM (according to the system time on your Amazon IoT device). It also uploads the recorded media daily from 7:00:00 PM to 9:59:59 PM.

      For more information, see StartEdgeConfigurationUpdate.

      { "StreamARN": "arn:aws:kinesisvideo:your-region:your-account-id:stream/your-stream/0123456789012", "EdgeConfig": { "HubDeviceArn": "arn:aws:iot:your-region:your-account-id:thing/kvs-edge-agent-demo", "RecorderConfig": { "MediaSourceConfig": { "MediaUriSecretArn": "arn:aws:secretsmanager:your-region:your-account-id:secret:your-secret-dRbHJQ", "MediaUriType": "RTSP_URI" }, "ScheduleConfig": { "ScheduleExpression": "0 0 9,10,11,12,13,14,15,16 ? * * *", "DurationInSeconds": 3599 } }, "UploaderConfig": { "ScheduleConfig": { "ScheduleExpression": "0 0 19,20,21 ? * * *", "DurationInSeconds": 3599 } }, "DeletionConfig": { "EdgeRetentionInHours": 15, "LocalSizeConfig": { "MaxLocalMediaSizeInMB": 2800, "StrategyOnFullSize": "DELETE_OLDEST_MEDIA" }, "DeleteAfterUpload": true } } }
    2. Type the following in the Amazon CLI to send the file to the Amazon Kinesis Video Streams Edge Agent:

      aws kinesisvideo start-edge-configuration-update --cli-input-json "file://example-edge-configuration.json"
  9. Repeat the previous step for each stream for the Amazon Kinesis Video Streams Edge Agent.