Connecting to an Amazon Timestream for InfluxDB DB instance - Amazon Timestream

Connecting to an Amazon Timestream for InfluxDB DB instance

Before you can connect to a DB instance, you must create the DB instance. For information, see Creating a DB instance. After Amazon Timestream provisions your DB instance, use the influxDB API, Influx CLI or any compatible client or utility for InfluxDB to connect to the DB instance.

Finding the connection information for an Amazon Timestream for InfluxDB DB instance

The connection information for a DB instance includes its endpoint, port, username, password and a valid access token, such as the operator or all access token. For example, for an InfluxDB DB instance, suppose that the endpoint value is influxdb1-123456789.us-east-1.timestream-influxdb.amazonaws.com. In this case, the port value is 8086, and the database user is admin. Given this information, you specify the following values in a connection string:

  • For host or host name or DNS name, specify influxdb1-123456789.us-east-1.timestream-influxdb.amazonaws.com.

  • For port, specify 8086.

  • For user, specify admin.

  • For password, specify the one you provided when creating your DB instance.

Important

When you created your Timestream for InfluxDB Db instance, part of the DBInstance response object you receive a influxAuthParametersSecretArn. This will hold an arn to a SecretsManager secret in your account. It will only be populated after your InfluxDB DB instances is available. The secret contains influx authentication parameters provided during the CreateDbInstance process. This is a READONLY copy as any updates/modifications/deletions to this secret doesn't impact the created DB instance. If you delete this secret, our API response will still refer to the deleted secret arn.

The endpoint is unique for each DB instance, and the values of the port and user can vary. To connect to a DB instance, you can use the Influx CLI, Influx API, or any any client compatible with InfluxDB.

To find the connection information for a DB instance, use the AWS Management Console. You can also use the AWS Command Line Interface (AWS CLI) describe-db-instances command or the Timestream-influxdb API GetDBInstance operation.

Using the AWS Management Console
  1. Sign in to the AWS Management Console and open the Amazon Timestream console.

  2. In the navigation pane, choose InfluxDB Databases to display a list of your DB instances.

  3. Choose the name of the DB instance to display its details.

  4. On the Summary section , copy the endpoint. Also, note the port number. You need both the endpoint and the port number to connect to the DB instance.

If you need to find the user name and password information, choose the Configuration Details tab and choose the influxAuthParametersSecretArn to access your Secrets Manager.

Using the CLI
  • To find the connection information for a InfluxDB DB instance by using the AWS CLI, call the get-db-instance command. In the call, query for the DB instance ID, endpoint, port, and influxAuthParametersSecret.

    For Linux, macOS, or Unix:

    aws timestream-influxdb get-db-instance --identifier id \ --query "[name,endpoint,influxAuthParametersSecretArn]"

    For Windows:

    aws timestream-influxdb get-db-instance --identifier id \ --query "[name,endpoint,influxAuthParametersSecretArn]"

    Your output should be similar to the following. To access the username information you will need to check the InfluxAuthParameterSecret.

    [ [ "mydb", "mydb-123456789012.us-east-1.timestream-influxdb.amazonaws.com", 8086, ] ]

Creating Access Tokens

With this information you are going to be able to connect for your instance to retrieve or create your access tokens. There are several ways to achieve this:

Using the CLI
  1. If you haven’t already, download, install, and configure the influx CLI.

  2. When configuring your Influx CLI config use --username-password to authenticate.

    influx config create --config-name YOUR_CONFIG_NAME --host-url "https://yourinstance.timestream-influxdb.amazonaws.com:8086" --org yourorg --username-password admin --active
  3. Use the influx auth create command to re-create your operator token. Take into account that this process will invalidate the old operator token.

    influx auth create --org kronos --operator
  4. Once you have the operator token, you can use the influx auth list command to view tokens all your tokens. You can use the influx auth create command to create an all access token.

Important

You will need to perform this step to obtain your operator token first, to then be able to create new tokens using the InfluxDB API or CLI.

Using the Influx UI
  1. Browse to your Timestream for InfluxDB instance using the created endpoint to log in and access the InfluxDB UI. You will need to use the username and password used to create your InfluxDB DB instance. You can retrieve this information from the influxAuthParametersSecretArn that was specified in the response object of the CreateDbInstance.

    Alternatively you can open the InfluxUI from the Timestream for InfluxDB management Console:

    1. Sign in to the AWS Management Console and open the Amazon Timestream for InfluxDB console at https://console.aws.amazon.com/timestream/.

    2. In the upper-right corner of the Amazon Timestream for InfluxDB console, choose the AWS Region in which you created the DB instance.

    3. In the Databases list, choose the name of your InfluxDB instance to show its details. In the upper right corner, choose Open Influx UI.

  2. Once logged into your InfluxUI, navigate to Load Data and then API Tokens using the left navigation bar.

  3. Choose + GENERATE API TOKEN and select All Access API Token.

  4. Enter a description for the API token and choose SAVE.

  5. Copy the generated token and store it for safe keeping.

Important

When creating tokens from the InfluxUI, the newly created tokens are only going to be shown once. Make sure you copy these since if not, you will need to re-created them.

Using the InfluxDB API
  • Send a request to the InfluxDB API /api/v2/authorizations endpoint using the POST request method.

    Include the following with your request:

    1. Headers:

      1. Authorization: Token <INFLUX_OPERATOR_TOKEN>

      2. Content-Type: application/json

    2. Request body: JSON body with the following properties:

      1. status: "active"

      2. description: API token description

      3. orgID: InfluxDB organization ID

      4. permissions: Array of objects where each object represents permissions for an InfluxDB resource type or a specific resource. Each permission contains the following properties:

        1. action: “read” or “write”

        2. resource: JSON object that represents the InfluxDB resource to grant permission to. Each resource contains at least the following property: orgID: InfluxDB organization ID

        3. type: Resource type. For information about what InfluxDB resource types exist, use the /api/v2/resources endpoint.

The following example uses curl and the InfluxDB API to generate an all access token:

export INFLUX_HOST=https://influxdb1-123456789.us-east-1.timestream-influxdb.amazonaws.com export INFLUX_ORG_ID=<YOUR_INFLUXDB_ORG_ID> export INFLUX_TOKEN=<YOUR_INFLUXDB_OPERATOR_TOKEN> curl --request POST \ "$INFLUX_HOST/api/v2/authorizations" \ --header "Authorization: Token $INFLUX_TOKEN" \ --header "Content-Type: text/plain; charset=utf-8" \ --data '{ "status": "active", "description": "All access token for get started tutorial", "orgID": "'"$INFLUX_ORG_ID"'", "permissions": [ {"action": "read", "resource": {"orgID": "'"$INFLUX_ORG_ID"'", "type": "authorizations"}}, {"action": "write", "resource": {"orgID": "'"$INFLUX_ORG_ID"'", "type": "authorizations"}}, {"action": "read", "resource": {"orgID": "'"$INFLUX_ORG_ID"'", "type": "buckets"}}, {"action": "write", "resource": {"orgID": "'"$INFLUX_ORG_ID"'", "type": "buckets"}}, {"action": "read", "resource": {"orgID": "'"$INFLUX_ORG_ID"'", "type": "dashboards"}}, {"action": "write", "resource": {"orgID": "'"$INFLUX_ORG_ID"'", "type": "dashboards"}}, {"action": "read", "resource": {"orgID": "'"$INFLUX_ORG_ID"'", "type": "orgs"}}, {"action": "write", "resource": {"orgID": "'"$INFLUX_ORG_ID"'", "type": "orgs"}}, {"action": "read", "resource": {"orgID": "'"$INFLUX_ORG_ID"'", "type": "sources"}}, {"action": "write", "resource": {"orgID": "'"$INFLUX_ORG_ID"'", "type": "sources"}}, {"action": "read", "resource": {"orgID": "'"$INFLUX_ORG_ID"'", "type": "tasks"}}, {"action": "write", "resource": {"orgID": "'"$INFLUX_ORG_ID"'", "type": "tasks"}}, {"action": "read", "resource": {"orgID": "'"$INFLUX_ORG_ID"'", "type": "telegrafs"}}, {"action": "write", "resource": {"orgID": "'"$INFLUX_ORG_ID"'", "type": "telegrafs"}}, {"action": "read", "resource": {"orgID": "'"$INFLUX_ORG_ID"'", "type": "users"}}, {"action": "write", "resource": {"orgID": "'"$INFLUX_ORG_ID"'", "type": "users"}}, {"action": "read", "resource": {"orgID": "'"$INFLUX_ORG_ID"'", "type": "variables"}}, {"action": "write", "resource": {"orgID": "'"$INFLUX_ORG_ID"'", "type": "variables"}}, {"action": "read", "resource": {"orgID": "'"$INFLUX_ORG_ID"'", "type": "scrapers"}}, {"action": "write", "resource": {"orgID": "'"$INFLUX_ORG_ID"'", "type": "scrapers"}}, {"action": "read", "resource": {"orgID": "'"$INFLUX_ORG_ID"'", "type": "secrets"}}, {"action": "write", "resource": {"orgID": "'"$INFLUX_ORG_ID"'", "type": "secrets"}}, {"action": "read", "resource": {"orgID": "'"$INFLUX_ORG_ID"'", "type": "labels"}}, {"action": "write", "resource": {"orgID": "'"$INFLUX_ORG_ID"'", "type": "labels"}}, {"action": "read", "resource": {"orgID": "'"$INFLUX_ORG_ID"'", "type": "views"}}, {"action": "write", "resource": {"orgID": "'"$INFLUX_ORG_ID"'", "type": "views"}}, {"action": "read", "resource": {"orgID": "'"$INFLUX_ORG_ID"'", "type": "documents"}}, {"action": "write", "resource": {"orgID": "'"$INFLUX_ORG_ID"'", "type": "documents"}}, {"action": "read", "resource": {"orgID": "'"$INFLUX_ORG_ID"'", "type": "notificationRules"}}, {"action": "write", "resource": {"orgID": "'"$INFLUX_ORG_ID"'", "type": "notificationRules"}}, {"action": "read", "resource": {"orgID": "'"$INFLUX_ORG_ID"'", "type": "notificationEndpoints"}}, {"action": "write", "resource": {"orgID": "'"$INFLUX_ORG_ID"'", "type": "notificationEndpoints"}}, {"action": "read", "resource": {"orgID": "'"$INFLUX_ORG_ID"'", "type": "checks"}}, {"action": "write", "resource": {"orgID": "'"$INFLUX_ORG_ID"'", "type": "checks"}}, {"action": "read", "resource": {"orgID": "'"$INFLUX_ORG_ID"'", "type": "dbrp"}}, {"action": "write", "resource": {"orgID": "'"$INFLUX_ORG_ID"'", "type": "dbrp"}}, {"action": "read", "resource": {"orgID": "'"$INFLUX_ORG_ID"'", "type": "notebooks"}}, {"action": "write", "resource": {"orgID": "'"$INFLUX_ORG_ID"'", "type": "notebooks"}}, {"action": "read", "resource": {"orgID": "'"$INFLUX_ORG_ID"'", "type": "annotations"}}, {"action": "write", "resource": {"orgID": "'"$INFLUX_ORG_ID"'", "type": "annotations"}}, {"action": "read", "resource": {"orgID": "'"$INFLUX_ORG_ID"'", "type": "remotes"}}, {"action": "write", "resource": {"orgID": "'"$INFLUX_ORG_ID"'", "type": "remotes"}}, {"action": "read", "resource": {"orgID": "'"$INFLUX_ORG_ID"'", "type": "replications"}}, {"action": "write", "resource": {"orgID": "'"$INFLUX_ORG_ID"'", "type": "replications"}} ] } '

Database authentication options

Amazon Timestream for InfluxDB supports the following ways to authenticate database users:

  • Password authentication – Your DB instance performs all administration of user accounts. You create users, specify passwords, and administer tokens using the InfluxUI, Influx CLI or influx API.

  • Token Authentication – Your DB instance performs all administration of user accounts. You can create users, specify password, and administer tokens using your operator token using the Influx CLI, and Influx API.

Encrypted connections

You can use Secure Socket Layer (SSL) or Transport Layer Security (TLS) from your application to encrypt a connection to a DB instance. The certificates needed for the TLS handshake between InfluxDB and the applications created and managed by the Kronos service. When the certificate is renewed, the instance is automatically updated with the latest version without requiring any user intervention.

Working with Parameter Groups

Database parameters specify how the database is configured. For example, database parameters can specify the amount of resources, such as memory, to allocate to a database.

You manage your database configuration by associating your DB instances with parameter groups. Amazon Timestream for InfluxDB defines parameter groups with default settings. You can also define your own parameter groups with customized settings.

Overview of parameter groups

A DB parameter group acts as a container for engine configuration values that are applied to one or more DB instances.

Default and custom parameter groups

DB instances use DB parameter groups. The following sections describe configuring and managing DB instance parameter groups.

Creating a DB parameter group

You can create a new DB parameter group using the AWS Management Console, the AWS Command Line Interface, or the Timestream API.

The following limitations apply to the DB parameter group name:

  • The name must be 1 to 255 letters, numbers, or hyphens.

  • Default parameter group names can include a period, such as default.InfluxDB.2.7. However, custom parameter group names can't include a period.

  • The first character must be a letter.

  • The name cannot start with “dbpg-”

  • The name can't end with a hyphen or contain two consecutive hyphens.

  • If you create a DB instance without specifying a DB parameter group, the DB instance uses the influxDB engine defaults.

You can't modify the parameter settings of a default parameter group. Instead, you can do the following:

  1. Create a new parameter group.

  2. Change the settings of your desired parameters. Not all DB engine parameters in a parameter group are eligible to be modified.

  3. Update your DB instance to use the custom parameter group. For information about updating a DB instance, see Updating DB instances.

Note

If you have modified your DB instance to use a custom parameter group, and you start the DB instance, Amazon Timestream for InfluxDB automatically reboots the DB instance as part of the startup process.

Currently, you won’t be able to modify custom parameter groups once they have been created. If you need to change a parameter, it is required that you create a new custom parameter group and assign it to the instances that require this configuration change. If you update an existing DB instance to assign a new parameter group, it will always be applied immediately and reboot your instance.

Static and dynamic DB instance parameters

InfluxDB DB instance parameters are always static . They behave as follows:

When you change a static parameter, save the DB parameter group, and assign it to an instance, the parameter change takes effect automatically after the instance is rebooted.

When you associate a new DB parameter group with a DB instance, Timestream applies the modified static parameters only after the DB instance is rebooted. Currently the only option is apply immediately.

For more information about changing the DB parameter group, see Updating DB instances.

Supported parameters and parameter values

To determine the supported parameters for your DB instance, view the parameters in the DB parameter group used by the DB instance. For more information, see Viewing parameter values for a DB parameter group.

For more information about all parameter supported by the open-source version of InfluxDB, see InfluxDB configuration options. Currently you will only be able to modify the following InfluxDB parameters:

Parameter Description Default value Value
flux-log-enabled Include option to show detailed logs for Flux queries FALSE true, false
log-level Log output level. InfluxDB outputs log entries with severity levels greater than or equal to the level specified. info debug, info, error
no-tasks Number of queries allowed to execute concurrently. Setting to 0 allows an unlimited number of concurrent queries. FALSE true, false
query-concurrency Disable the task scheduler. If problematic tasks prevent InfluxDB from starting, use this option to start InfluxDB without scheduling or executing tasks. 1024
query-queue-size Maximum number of queries allowed in execution queue. When queue limit is reached, new queries are rejected. Setting to 0 allows an unlimited number of queries in the queue. 1024
tracing-type Enable tracing in InfluxDB and specifies the tracing type. Tracing is disabled by default. "" log, jaeger
metrics-disabled Disable the HTTP /metrics endpoint which exposes internal InfluxDB metrics. FALSE

Improperly setting parameters in a parameter group can have unintended adverse effects, including degraded performance and system instability. Always be cautious when modifying database parameters.Try parameter group setting changes on a test DB instance before applying those parameter group changes to a production DB instance.

Working with DB parameter groups

DB instances use DB parameter groups. The following sections describe configuring and managing DB instance parameter groups.

Creating a DB parameter group

Using the AWS Management Console
  1. Sign in to the AWS Management Console and open the Amazon Timestream for InfluxDB console.

  2. In the navigation pane, choose Parameter groups.

  3. Choose Create parameter group.

  4. In the Group name box, enter the name of the new DB parameter group.

  5. In the Description box, enter a description for the new DB parameter group.

  6. Choose the parameters to modify and apply the desired values. For more information on supported parameters, see Supported parameters and parameter values.

  7. Choose Save.

Using the AWS Command Line Interface
  • To create a DB parameter group by using the AWS CLI, call the create-db-parameter-group command with the following parameters:

    --db-parameter-group-name <value> --description <value> --endpoint_url <value> --region <value> --parameters (list) (string)
    Example

    For information about each setting, see Settings for DB instances. This example uses default engine configs.

    aws timestream-influxdb create-db-parameter-group --db-parameter-group-name YOUR_PARAM_GROUP_NAME\ --endpoint-url YOUR_ENDPOINT --region YOUR_REGION \ --parameters "InfluxDBv2={logLevel=debug,queryConcurrency=10,metricsDisabled=true}" \" \ --debug

Associating a DB parameter group with a DB instance

You can create your own DB parameter groups with customized settings. You can associate a DB parameter group with a DB instance using the AWS Management Console, the AWS Command Line Interface, or the Timestream-InfluxDB API. You can do so when you create or modify a DB instance.

For information about creating a DB parameter group, see Creating a DB parameter group. For information about creating a DB instance, see Creating a DB instance. For information about modifying a DB instance, see Updating DB instances..

Note

When you associate a new DB parameter group with a DB instance, the modified static parameters are applied only after the DB instance is rebooted. Currently, only apply immediately is supported. Timestream for InfluxDB only support static parameters.

Using the AWS Management Console
  1. Sign in to the AWS Management Console and open the Amazon Timestream for InfluxDB console.

  2. In the navigation pane, choose InfluxDB Databases, and then choose the DB instance that you want to modify.

  3. Choose Update. The Update DB instance page appears.

  4. Change the DB parameter group setting.

  5. Choose Continue and check the summary of modifications.

  6. Currently only Apply immediately is supported. This option can cause an outage in some cases since it will reboot your DB instance.

  7. On the confirmation page, review your changes. If they are correct, choose Update DB instance to save your changes and apply them. Or choose Back to edit your changes or Cancel to cancel your changes.

Using the AWS Command Line Interface

For Linux, macOS, or Unix:

aws timestream-influxdb update-db-instance --identifier YOUR_DB_INSTANCE_ID \ --region YOUR_REGION \ --db-parameter-group-identifier YOUR_PARAM_GROUP_ID \ --log-delivery-configuration "{\"s3Configuration\": {\"bucketName\": \"${LOGGING_BUCKET}\", \"enabled\": false }}"

For Windows:

aws timestream-influxdb update-db-instance --identifier YOUR_DB_INSTANCE_ID ^ --region YOUR_REGION ^ --db-parameter-group-identifier YOUR_PARAM_GROUP_ID ^ --log-delivery-configuration "{\"s3Configuration\": {\"bucketName\": \"${LOGGING_BUCKET}\", \"enabled\": false }}"

Listing DB parameter groups

You can list the DB parameter groups you've created for your AWS account.

Using the AWS Management Console
  1. Sign in to the AWS Management Console and open the Amazon Timestream for InfluxDB console.

  2. In the navigation pane, choose Parameter groups.

  3. The DB parameter groups appear in a list.

Using the AWS Command Line Interface

To list all DB parameter groups for an AWS account, use the AWS Command Line Interface list-db-parameter-groups command.

aws timestream-influxdb list-db-parameter-groups --region region

To return a specific DB parameter groups for an AWS account, use the AWS Command Line Interface get-db-parameter-group command.

aws timestream-influxdb get-db-parameter-group --region region --identifier identifier

Viewing parameter values for a DB parameter group

You can get a list of all parameters in a DB parameter group and their values.

Using the AWS Management Console
  1. Sign in to the AWS Management Console and open the Amazon Timestream for InfluxDB console.

  2. In the navigation pane, choose Parameter groups.

  3. The DB parameter groups appear in a list.

  4. Choose the name of the parameter group to see its list of parameters.

Using the AWS Command Line Interface

To view the parameter values for a DB parameter group, use the AWS Command Line Interface get-db-parameters command with the following required parameter.

--db-parameter-group-name

Using the API

To view the parameter values for a DB parameter group, use the Timestream API GetDBParameters command with the following required parameter.

DBParameterGroupName