Export EdgeX events to AWS S3
Overview
Amazon Simple Storage Service (Amazon S3) is cloud object storage. Edge Xpert provides a proprietary XpertHTTPExport
function to send data to AWS S3 through the REST API. This article will take you through steps to create an Edge Xpert application service to export data as generated by virtual device service to AWS S3.
Prerequisites
- Understand Edge Xpert Application Services
- Launch Edge Xpert core services
or use
edgexpert up
--secret
option to run in security modeedgexpert up --secret
- Set up Amazon S3
- Create access keys that consist of two parts: an access key ID and a secret access key. The access keys are required by App Service to caculate AWS Signuatures for HTTPS requests.
Configure an application service to export events to AWS S3
Edge Xpert provides a proprietary built-in function XpertHTTPExport
to produce events to the AWS S3. A sample configuration is provided with Edge Xpert CLI utility. Once you complete the installation of Edge Xpert CLI utility, the sample configuration is available at /usr/share/edgexpert/examples/app-configurable/awss3-http-export/configuration-insecure.toml
.
- Copy and save the sample configuration file as a separate file (for example, aws-s3.toml) to your working directory
-
Modify this configuration based on the AWS S3 settings.
Config Value Description URL https://{AWSS3BucketName}.s3.{AWSRegion}.amazonaws.com/event_{timestamp}.json Replace the {AWSS3BucketName}
(e.g. shellopenxpot),{AWSRegion}
(e.g. us-east-1) that set in Prerequisites Step 3AWSV4SignerConfigs '{"region": "{AWSRegion}", "service": "s3"}' Replace the {AWSRegion}
(e.g. us-east-1) -
If the application service is not launched in secure mode, secrets will be retrieved from
Writable.InsecureSecrets
configuration. You will need to updateWritable.InsecureSecrets.AWS
configuration with correct values ofaws_access_key
andaws_secret_key
that obtain from Prerequisites Step 4:[Writable.InsecureSecrets.AWS] path = "aws" [Writable.InsecureSecrets.AWS.Secrets] aws_access_key='' aws_secret_key=''
-
Once configuration is ready, you can launch the application service in secure mode using command below:
If you prefer to launch the application service in insecure mode, use command below:edgexpert up --secret app-service --path=<path of the configuration file>
edgexpert up app-service --path=<path of the configuration file>
-
If the application service is launched under secure mode on previous step, secrets will be retrieved from Vault secret store. Users need to add
aws_access_key
andaws_secret_key
into Vault secret store. Please refer to EdgeX Foundry Storing Secrets for details about adding secrets into Vault secret store. -
Now, an application service is up and ready to export events to AWS S3. To simulate the device sending readings from southbound, you can start up the virtual device service:
# Under secure mode edgexpert up --secret device-virtual # Under insecure mode edgexpert up device-virtual
-
The data can be viewed from the AWS Management Console by selecting an object and clicking
Actions
>Query with S3 Select
-
AWS S3 also allows users to view the data with a HTTPS URL that can be retrieved by clicking
Share with a presigned URL
More configuration details about XpertHTTPExport
Refer to XpertHTTPExport configuration.