Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

Default client configuration for Go

Focus mode
Default client configuration for Go - Amazon DynamoDB

This guide will walk you through the configuration options that allow you to fine-tune your DAX client's performance, connection management, and logging behavior. By understanding the default settings and how to customize them, you can optimize your Go application's interaction with DAX.

DAX Go SDK Client Defaults

Parameter Type Description

Region

required

string

The AWS Region to use for the DAX client (example- 'us-east-1'). This is a required parameter if not provided through the environment.

HostPorts

required

[] string

List of DAX cluster endpoints to which SDK connects.

For example:

Non-Encrypted – dax://my-cluster.l6fzcv.dax-clusters.us-east-1.amazonaws.com

Encrypted – daxs://my-cluster.l6fzcv.dax-clusters.us-east-1.amazonaws.com

MaxPendingConnectionsPerHost

default 10

number

Number of concurrent connection attempts. (Connections can be in the process of being established concurrently.)

ClusterUpdateThreshold

default 125 * time.Millisecond

time.Duration

The minimum time that must elapse between cluster refreshes.

ClusterUpdateInterval

default 4 * time.Second

time.Duration

The interval at which the client will automatically refresh the DAX cluster information.

IdleConnectionsReapDelay

default 30 * time.Second

time.Duration

The interval at which the client will close idle connections in the DAX client.

ClientHealthCheckInterval

default 5 * time.Second

time.Duration

The interval at which the client will perform health checks on the DAX cluster endpoints.

Credentials

default

aws.CredentialsProvider

The AWS credentials used by the DAX client to authenticate requests to the DAX service. See Credentials and Credential Providers.

DialContext

default

func

A custom function used by the DAX client to establish connections to the DAX cluster.

SkipHostnameVerification

default false

bool

Skip hostname verification of TLS connections. This setting only affects encrypted clusters. When set to True, it disables hostname verification. Disabling verification means you can't authenticate the identity of the cluster you're connecting to, which poses security risks. By default, hostname verification is enabled.

RouteManagerEnabled

default false

bool

This flag is used to remove routes facing network errors.

RequestTimeout

default 60 * time.Second

time.Duration

This defines the maximum time the client will wait for a response from DAX.

Priority: Context timeout (if set) > RequestTimmeout (if set) > Default 60s RequestTimeout.

WriteRetries

default 2

number

The number of retries to attempt for write requests that fail.

ReadRetries

default 2

number

The number of retries to attempt for read requests that fail.

RetryDelay

default 0

time.Duration

The delay for non-throttled errors (in seconds) for retry attempts when a request fails.

Logger

optional

logging.Logger

Logger is an interface for logging entries at certain classifications.

LogLevel

default utils.LogOff

number

This loglevel is defined for DAX only. It can be imported using github.com/aws/aws-dax-go-v2/tree/main/dax/utils.

const ( LogOff LogLevelType = 0 LogDebug LogLevelType = 1 LogDebugWithRequestRetries LogLevelType = 2 )
Note

For time.Duration, the default unit is nanosecond. If we don’t specify any unit for any parameter then it will consider that as nano seconds: daxCfg.ClusterUpdateInterval = 10 means 10 nano seconds. (daxCfg.ClusterUpdateInterval = 10 * time.Millisecond means 10 milliseconds).

Client creation

To create a DAX client:
  • Create DAX config, then create DAX client using DAX config. Using this, you can overwrite a DAX configuration if required.

    import ( "github.com/aws/aws-dax-go-v2/dax/utils" "github.com/aws/aws-dax-go-v2/dax" ) // Non - Encrypted : 'dax://my-cluster.l6fzcv.dax-clusters.us-east-1.amazonaws.com'. // Encrypted : daxs://my-cluster.l6fzcv.dax-clusters.us-east-1.amazonaws.com'. config := dax.DefaultConfig() config.HostPorts = []string{endpoint} config.Region = region config.LogLevel = utils.LogDebug daxClient, err := dax.New(config)
PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.