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
regionprimitivea text property, AWS region to connect to
any-one-of
endpointOverrideprimitivea text property, Overrides the AWS service endpoint
clientall-ofCommon settings for AWS service clients

Field Descriptionsโ€‹

FieldNameFormatDescriptionSources
typemapa text property, AWS credentials provider
primitivea constant property, AWS credentials provider

clientโ€‹

FieldNameFormatDescriptionSources
extraHeaderslistExtra headers to be sent with each request
apiCallTimeoutprimitivea duration property, Amount of time to allow the client to complete the execution of an API call
apiCallAttemptTimeoutprimitivea duration property, Amount of time to wait for the HTTP request to complete before giving up
defaultProfileNameprimitivea text property, Default profile name

extraHeadersโ€‹

FieldNameFormatDescriptionSources
nameprimitivea text property, Header name
valuelista text property, 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
)

ZIO Chat

Hello! ๐Ÿ˜Š I'm your ZIO Chat Bot, designed to be your go-to resource for all things ZIO! Whether you're new to this powerful functional effect system or a seasoned pro, I'm here to assist you. ZIO empowers you to build concurrent and resilient applications in Scala, offering referential transparency, composable data types, type-safety, and more. So, go ahead and ask me anything about ZIO โ€“ I'm here to provide the answers you need! ๐Ÿค–