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​
FieldName | Format | Description | Sources |
---|---|---|---|
all-of |
Field Descriptions​
FieldName | Format | Description | Sources |
---|---|---|---|
region | primitive | value of type string, optional value, AWS region to connect to | |
credentials | any-one-of | default value: DefaultCredentialsProvider(providerChain=LazyAwsCredentialsProvider(delegate=Lazy(value=Uninitialized))), AWS credentials provider | |
endpointOverride | primitive | value of type uri, optional value, Overrides the AWS service endpoint | |
client | all-of | optional value, Common settings for AWS service clients |
credentials​
FieldName | Format | Description | Sources |
---|---|---|---|
primitive | value of type string | ||
primitive | value of type string | ||
primitive | value of type string | ||
all-of |
Field Descriptions​
FieldName | Format | Description | Sources |
---|---|---|---|
accessKeyId | primitive | value of type string, AWS access key ID | |
secretAccessKey | primitive | value of type string, AWS secret access key |
client​
FieldName | Format | Description | Sources |
---|---|---|---|
extraHeaders | list | Extra headers to be sent with each request | |
apiCallTimeout | primitive | value of type duration, optional value, Amount of time to allow the client to complete the execution of an API call | |
apiCallAttemptTimeout | primitive | value of type duration, optional value, Amount of time to wait for the HTTP request to complete before giving up | |
defaultProfileName | primitive | value of type string, optional value, Default profile name |
extraHeaders​
FieldName | Format | Description | Sources |
---|---|---|---|
name | primitive | value of type string, Header name | |
any-one-of |
Field Descriptions​
FieldName | Format | Description | Sources |
---|---|---|---|
value | list | value of type string, Header value | |
value | primitive | value 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
)