Skip to main content
Version: 2.x

Configuration

Common configuration

Each service module depends on the AwsConfig layer. This layer is responsible for setting up the AWS Java SDK's async client, by setting the underlying HTTP engine and all the common settings. You can use the following layers to provide AwsConfig:

Default

AwsConfig.default requires a HttpClient as dependency, but does not customize any other setting of the client

Fully customized

AwsConfig.customized(customization) gives the freedom to customize the creation of the AWS async client directly by modifying it's Builder

Configured

AwsConfig.configured() is the recommended way to construct an AwsConfig. Beside requiring a HttpClient it also has ZConfig[CommonAwsConfig] as dependency. The CommonAwsConfig value can be either provided from code for example by ZLayer.succeed(CommonAwsConfig(...)) or it can be read from any of the supported config sources by zio-config.

Note that AWS level retries are disabled by the configuration layer and it is not exposed in the CommonAwsConfig data structure either. The reason for this is that the recommended way to handle retries is to use aspects on the service layers.

See the following table about the possible configuration values. Please note that the underlying HTTP engine also has its own specific configuration which is described on the page about the HTTP engines.

Configuration Details

FieldNameFormatDescriptionSources
all-of

Field Descriptions

FieldNameFormatDescriptionSources
regionprimitivevalue of type string, optional value, AWS region to connect to
credentialsany-one-ofdefault value: DefaultCredentialsProvider(providerChain=LazyAwsCredentialsProvider(delegate=Lazy(value=Uninitialized))), AWS credentials provider
endpointOverrideprimitivevalue of type uri, optional value, Overrides the AWS service endpoint
clientall-ofoptional value, Common settings for AWS service clients

credentials

FieldNameFormatDescriptionSources
primitivevalue of type string
primitivevalue of type string
primitivevalue of type string
all-of

Field Descriptions

FieldNameFormatDescriptionSources
accessKeyIdprimitivevalue of type string, AWS access key ID
secretAccessKeyprimitivevalue of type string, AWS secret access key

client

FieldNameFormatDescriptionSources
extraHeaderslistExtra headers to be sent with each request
apiCallTimeoutprimitivevalue of type duration, optional value, Amount of time to allow the client to complete the execution of an API call
apiCallAttemptTimeoutprimitivevalue of type duration, optional value, Amount of time to wait for the HTTP request to complete before giving up
defaultProfileNameprimitivevalue of type string, optional value, Default profile name

extraHeaders

FieldNameFormatDescriptionSources
nameprimitivevalue of type string, Header name
any-one-of

Field Descriptions

FieldNameFormatDescriptionSources
valuelistvalue of type string, Header value
valueprimitivevalue of type string, Header value

Service layer

Each AWS service's generated client has it own layer that depends on AwsConfig. It is possible to reuse the same AwsConfig layer for multiple AWS service clients, sharing a common configuration. Usually the service client does not require any additional configuration, in this case the live layer can be used, for example:

program.provide(
awsConfig,
Ec2.live,
ElasticBeanstalk.live
)