Skip to content

timesteam influxdb setup with kafka connect / normal python code

0

Hello was trying to setuptimestream influxdb data ingestion from kafka .. I had to give Influxdb is have public access, meaning i can open the directly UI when I am adding my IP to inbound rule for 8086 in same sg...

We have tried two ways, first with kafka connect jar, then with running a small python script. in both we have faced different issue..

**First used kafka connect: **

Using https://github.com/awslabs/amazon-timestream-tools/tree/mainline/integrations/kafka_connector .. I cloned the repo & build the jar kafka-connector-timestream-1.0-SNAPSHOT-jar-with-dependencies.jar .. in aws msk connector ,

connector.class=software.amazon.timestream.TimestreamSinkConnector
timestream.database.name=timestream-influxdb-test-turjo  ## This table name if not provided, it was giving error table name is empty.. so gave a dummy name. 
timestream.table.name=data_table
timestream.schema.s3.bucket.name=timestream-influx-config
tasks.max=2
topics=topicname
timestream.influxdb.bucket=data_kf
timestream.ingestion.endpoint=https://<VPC ENDPOINT for timestream interface gateway>
aws.region=eu-west-2
timestream.schema.s3.key=schema_def/schema.json
timestream.influxdb.url=https://<INFLUX DB ENDPOINT>:8086
timestream.target.liveanalytics=false
timestream.influxdb.token=<INFLUXDBTOKEN>
timestream.influxdb.org=ea
value.converter=org.apache.kafka.connect.json.JsonConverter
key.converter=org.apache.kafka.connect.storage.StringConverter
timestream.target.influxdb=true

both msk & influxdb are in same vpc, sg assigned.. in sg 8086 port is open for self connection(in source same sg is given)

**ISSUE: ** timestream influxdb does not have database or table .. database name i had given the database instance name that comes under influxdata base list.. timestream.database.name=timestream-influxdb-test-turjo timestream.table.name=data_table

Influx db

But we are getting error timestream-influxdb-test-turjo does not exists. [Worker-0c5283c0533854bb9] [2025-05-16 11:56:11,861] ERROR [influxdbconnector12|task-0] ERROR::AWSServiceClientObjectsValidator::validateTimestreamDatabase (software.amazon.timestream.utility.AWSServiceClientObjectsValidator:89)

Question 1: Could someone please help what should be the database name & table for influx db.. After login to InfluxDB UI, I dont any see database or Table name... it looks like database & table came are part of timestream liveanalytics.. but I am using timestream influxdb.. so why we need to configure those ?

**Running with Python : **

As with kafka connect, we were facing above issue, tried with simple python code to push dummy data to influx that worked.. bucket = "BUCKET" org = "ORG" token = "TOKEN" url="https://<INFLUX ENDPOINT>" client = influxdb_client.InfluxDBClient( url=url, token=token, org=org ) write_api = client.write_api(write_options=SYNCHRONOUS) p = influxdb_client.Point("my_measurement").tag("location", "Prague").field("temperature", 15.3) write_api.write(bucket=bucket, org=org, record=p)

**Question 2: ** Here we faced connectivity issue from ec2 to influx endpoint.. Ec2 & influx were in same vpc . sg group has 8086 port open for self group & also ec2 private IP separately. Influxdb was made publiclyAccessible True, so that the UI can be opened.. If it was made private,Then UI button was disabled. If I add ec2 public IP to sg group inbound rule, then it works.. But with ec2 private IP sg group inbound rule, it is not able to connect to the influx end point.. connection timeout..

I had created one VPC interface endpoint also having following policy.. { "Statement": [ { "Action": "", "Effect": "Allow", "Principal": "", "Resource": "*" } ] }

How do I make ec2 private IP to connect to influxdb.. not connect via public ??

2 Answers
0

For the question 1 .. I guess https://github.com/awslabs/amazon-timestream-tools/tree/mainline/integrations/kafka_connector is not updated. i added some logic to ignore database name & table for influxdb .. then those errors were gone...

But now in kafka connect getting the same error while writing data to influx.. [Worker-0117b930c66704a7f] com.influxdb.exceptions.InfluxException: connect timed out

Although when connector coming up.. it says [Worker-0117b930c66704a7f] [2025-05-19 08:24:24,529] INFO [influxdbconnector21|task-1] INFO::TimeStreamWriter:: influxDB client successfull connected: [https://6fcogbpelo-7gox52bqpwjkez.timestream-influxdb.eu-west-2.on.aws:8086] [databento_kf] [ea] (software.amazon.timestream.utility.TimestreamWriter:124)

issue is while writing it says connect time out.. any idea ? Basically i think withing vpc it is not able to connect to 8086 and getting timeout

answered a year ago

-1

Regarding your questions about setting up Amazon Timestream for InfluxDB with Kafka Connect and Python, I can provide some clarification:

Question 1: For Timestream for InfluxDB, you don't need to specify a database name or table name in the same way as you would for Timestream LiveAnalytics. Instead, you should focus on the InfluxDB-specific parameters:

  • timestream.influxdb.bucket: This is the InfluxDB bucket where your data will be stored.
  • timestream.influxdb.org: This is your InfluxDB organization.
  • timestream.influxdb.url: This should be the endpoint URL for your InfluxDB instance.
  • timestream.influxdb.token: This is your InfluxDB authentication token.

You should remove or comment out the Timestream-specific parameters like timestream.database.name and timestream.table.name as they are not applicable for InfluxDB. The error you're seeing about the database not existing is likely because the connector is trying to use Timestream-specific configurations with InfluxDB.

Question 2: The connectivity issue you're facing is related to network configuration. Even though your EC2 instance and InfluxDB are in the same VPC, there are a few things to check:

  1. Ensure that the security group attached to your InfluxDB instance allows inbound traffic on port 8086 from the security group of your EC2 instance.

  2. Check that your EC2 instance's route table includes a route to the InfluxDB instance's private IP or subnet.

  3. Verify that your VPC endpoint for Timestream InfluxDB is correctly configured and associated with the right subnets.

  4. Make sure your EC2 instance has the correct DNS settings to resolve the InfluxDB endpoint within the VPC.

The fact that it works with the public IP suggests there might be an issue with internal DNS resolution or routing. To resolve this:

  • Double-check your VPC's DNS settings.
  • Ensure that your EC2 instance is using the VPC's DNS server.
  • Try using the private IP address of the InfluxDB instance instead of its DNS name in your connection string.

If you still can't connect using the private IP, you may need to review your VPC configuration, including route tables and network ACLs, to ensure there are no restrictions preventing internal communication.

Remember, for production use, it's recommended to keep your InfluxDB instance private and use a bastion host or VPN for secure access to the UI, rather than making it publicly accessible.
Sources
Run and manage open source InfluxDB databases with Amazon Timestream | AWS News Blog
Creating and connecting to a Timestream for InfluxDB instance - Amazon Timestream
Use the AWS InfluxDB migration script to migrate your InfluxDB OSS 2.x data to Amazon Timestream for InfluxDB | AWS Database Blog

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.