Build the Amazon Kinesis Video Streams Edge Agent
Build the Amazon Kinesis Video Streams Edge Agent
-
Download the
tarfile using the link that was provided to you.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
. -
Verify the checksum.
-
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/EdgeAgentVersionkvs-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.soNote
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.
-
Build the dependencies jar.
Note
The jar included with the
kvs-edge-agent.tar.gzdoes not have the dependencies. Use the following steps to build those libraries.Navigate to the
kvs-edge-agentfolder that containspom.xml.Type
mvn clean package.This generates a jar file containing the dependencies the Amazon Kinesis Video Streams Edge Agent requires at
kvs-edge-agent/target/libs.jar. -
Place the
libs.jarinto the folder that contains the component's artifacts.Type
mv ./target/libs.jar ./KvsEdgeComponent/artifacts/aws.kinesisvideo.KvsEdgeComponent/.EdgeAgentVersion/ -
Set environment variables using the values from previous steps. The following table provides descriptions for the variables.
Environment Variable Name Required Description AWS_REGIONYes
The Region that is used.
Example: us-west-2
AWS_IOT_CA_CERTYes
File path to the CA certificate used to establish trust with the backend service through TLS.
Example:
/file/path/to/AmazonRootCA1.pemAWS_IOT_CORE_CERTYes
File path to the X.509 certificate.
Example:
/file/path/to/certificateID-certificate.pem.crtAWS_IOT_CORE_CREDENTIAL_ENDPOINTYes
The Amazon IoT Core credential endpoint provider endpoint for your Amazon account.
Example:
credential-account-specific-prefix.credentials.iot.aws-region.amazonaws.comAWS_IOT_CORE_DATA_ATS_ENDPOINTYes
The Amazon IoT Core data plane endpoint for your Amazon account.
Example:
data-account-specific-prefix.iot.aws-region.amazonaws.comAWS_IOT_CORE_PRIVATE_KEYYes
File path to the private key used in the public/private key pair. For more information, see Key management in Amazon IoT.
Example:
/file/path/to/certificateID-private.pem.keyAWS_IOT_CORE_ROLE_ALIASYes
The name of the role alias pointing to the Amazon IAM role to use when connecting to Amazon IoT Core.
Example:
kvs-edge-role-aliasAWS_IOT_CORE_THING_NAMEYes
The name of the Amazon IoT thing that the application is being run on.
Example:
my-edge-device-thingGST_PLUGIN_PATHYes
File path pointing to the folder that contains the
gstkvssinkandIngestorPipelineJNIplatform-dependent libraries. 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_PATHYes
File path pointing to the directory containing the
cproducerandKinesisVideoProducerplatform-dependent libraries.Example:
/download-location/kvs-edge-agent/KvsEdgeComponent/artifacts/aws.kinesisvideo.KvsEdgeComponent/EdgeAgentVersion/lib/AWS_KVS_EDGE_CLOUDWATCH_ENABLEDNo
Determines if the Amazon Kinesis Video Streams Edge Agent will post job health metrics onto Amazon CloudWatch.
Accepted values:
TRUE/FALSE(case insensitive). Defaults toFALSEif not provided.Example: FALSE
AWS_KVS_EDGE_LOG_LEVELNo
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:
INFOAWS_KVS_EDGE_LOG_MAX_FILE_SIZENo
Once the log file reaches this size, a rollover will occur.
-
Min: 0
-
Max: 10000
-
Default: 20, if not provided
-
Units: Megabytes (MB)
Example: 5
AWS_KVS_EDGE_LOG_OUTPUT_DIRECTORYNo
The file path pointing to the directory where the Amazon Kinesis Video Streams Edge Agent logs are output. Defaults to
./logif not provided.Example:
/file/path/AWS_KVS_EDGE_LOG_ROLLOVER_COUNTNo
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_DIRECTORYNo
File path pointing to the directory recorded media will be written to. Defaults to the current directory if not provided.
Example:
/file/path/GST_DEBUGNo
Specifies the level of GStreamer logs to output. For more information, see the GStreamer documentation
. Example: 0
GST_DEBUG_FILENo
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 -
-
Clear the GStreamer cache. Type:
rm ~/.cache/gstreamer-1.0/registry.your-os-architecture.binFor more information, see the GStreamer registry documentation
. -
Prepare and run the java command. The Amazon Kinesis Video Streams Edge Agent accepts the following arguments:
Java Property Name Required Description java.library.pathNo
File path pointing to the folder containing the
gstkvssinkandIngestorPipelineJNIdependent libraries. If not provided, the Amazon Kinesis Video Streams Edge Agent will search for them in the current directory.Important
The Amazon Kinesis Video Streams Edge Agent won't function correctly if it can't locate these files.
Example:
/file/path/To set these, add
-Dto the java command used to run the jar.java-property-name=valueFor example:
java -Djava.library.path=/download-location/kvs-edge-agent/KvsEdgeComponent/artifacts/aws.kinesisvideo.KvsEdgeComponent/EdgeAgentVersion\ --add-opens java.base/jdk.internal.misc=ALL-UNNAMED \ -Dio.netty.tryReflectionSetAccessible=true \ -cp kvs-edge-agent.jar:libs.jar \ com.amazonaws.kinesisvideo.edge.controller.ControllerAppImportant
Run the java command above from the same directory as
/.download-location/kvs-edge-agent/KvsEdgeComponent/artifacts/aws.kinesisvideo.KvsEdgeComponent/EdgeAgentVersion -
Send configurations to the application using the Amazon CLI.
-
Create a new file,
.example-edge-configuration.jsonPaste 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 } } } -
To send the file to the Amazon Kinesis Video Streams Edge Agent, type the following in the Amazon CLI:
aws kinesisvideo start-edge-configuration-update --cli-input-json "file://example-edge-configuration.json"
-
-
Repeat the previous step for each stream for the Amazon Kinesis Video Streams Edge Agent.