Documentation

Write data with third-party technologies

Configure third-party technologies to send line protocol directly to InfluxDB.

AWS Lambda via CloudFormation template

Write to InfluxDB with AWS Lambda, Amazon Web Services’ serverless offering. This example provides a CloudFormation template that collects earthquake from the United States Geological Survey (USGS) every hour and outputs it as line protocol into an InfluxDB bucket.

The template contains the following sections:

  • Lines 1-20: Define variables that the template asks for when it’s installed.
  • Lines 21-120: Handle a quirk of Lambda deployments that requires the Lambda assets to be in your region before deployment. As there is no elegant workaround, these 100 lines create an S3 bucket in your account in the region you’re creating the stack and copies in these resources.
  • Lines 121-132: Define a role with basic permission to run the Lambda.
  • Lines 133-144: Define a Python library layer. This layer packages the Python HTTP library, a Python S2 Geometry library, and the InfluxDB Python client library.
  • Lines 145-165: Define the Lambda function, a short Python script zipped up in a file called geo_lambda.zip.
  • Lines 166-188: Define an event rule with permission to run the Lambda every hour.

Deploy the template

  1. Log into your free AWS account and search for the CloudFormation service. Make sure you’re in the AWS region you want to deploy the Lambda to⁠.
  2. Click Create Stack.
  3. In the Prerequisite - Prepare Template section, select Template is ready.
  4. In the Specify template section:
  • Under Template source, select Amazon S3 URL.
  • In the Amazon S3 URL field, enter the CloudFormation template URL: https://influxdata-lambda.s3.amazonaws.com/GeoLambda.yml
  1. Click Next.
  2. Enter a name in the Stack name field.
  3. Enter the following InfluxDB details:
  • Organization ID
  • Bucket ID of the bucket the Lambda writes to
  • Token with permission to write to the bucket
  • InfluxDB URL
  1. Do not alter or add to any other fields. Click Next.
  2. Select the I acknowledge that AWS CloudFormation might create IAM resources check box.
  3. Click Create Stack.

After a few minutes, the stack deploys to your region. To view the new Lambda, select Services > AWS Lambda. On the Lambda functions page, you should see your new Lambda. The CopyZipsFunction is the helper copy function, and the GeoPythonLambda does the data collection and writing work:

GeoPythonLambda data in InfluxDB

Verify your setup

GeoPythonLambda should run every hour based on the AWS Rule we set up, but you should test and confirm it works.

  1. Click GeoPythonLambda, and then click Test.
  2. The test requires an input definition, but this Lambda has no input requirements, so click through and save the default dataset.
  3. If the test is successful, a green Execution result: succeeded message appears.

With the data points written, when you log into your InfluxDB UI, you’ll be able to explore the geolocation earthquake data:

GeoPythonLambda data in InfluxDB

Was this page helpful?

Thank you for your feedback!


Set your InfluxDB URL

Linux Package Signing Key Rotation

All signed InfluxData Linux packages have been resigned with an updated key. If using Linux, you may need to update your package configuration to continue to download and verify InfluxData software packages.

For more information, see the Linux Package Signing Key Rotation blog post.

InfluxDB Cloud backed by InfluxDB IOx

All InfluxDB Cloud organizations created on or after January 31, 2023 are backed by the new InfluxDB IOx storage engine. Check the right column of your InfluxDB Cloud organization homepage to see which InfluxDB storage engine you’re using.

If powered by IOx, this is the correct documentation.

If powered by TSM, see the TSM-based InfluxDB Cloud documentation.

InfluxDB Cloud backed by InfluxDB TSM

All InfluxDB Cloud organizations created on or after January 31, 2023 are backed by the new InfluxDB IOx storage engine which enables nearly unlimited series cardinality and SQL query support. Check the right column of your InfluxDB Cloud organization homepage to see which InfluxDB storage engine you’re using.

If powered by TSM, this is the correct documentation.

If powered by IOx, see the IOx-based InfluxDB Cloud documentation.

State of the InfluxDB Cloud (IOx) documentation

The new documentation for InfluxDB Cloud backed by InfluxDB IOx is a work in progress. We are adding new information and content almost daily. Thank you for your patience!

If there is specific information you’re looking for, please submit a documentation issue.