aws-config
provides implementations of region, credential resolution.
These implementations can be used either via the default chain implementation
[from_env
]/[ConfigLoader
] or ad-hoc individual credential and region providers.
ConfigLoader
can combine different configuration sources into an AWS shared-config:
Config
. Config
can be used configure
an AWS service client.
Examples
Load default SDK configuration:
# mod aws_sdk_dynamodb {
# pub struct Client;
# impl Client {
# pub fn new(config: &aws_types::config::Config) -> Self { Client }
# }
# }
# async fn docs() {
let config = aws_config::load_from_env().await;
let client = aws_sdk_dynamodb::Client::new(&config);
# }
Load SDK configuration with a region override:
use aws_config::meta::region::RegionProviderChain;
# mod aws_sdk_dynamodb {
# pub struct Client;
# impl Client {
# pub fn new(config: &aws_types::config::Config) -> Self { Client }
# }
# }
# async fn docs() {
let region_provider = RegionProviderChain::default_provider().or_else("us-east-1");
let config = aws_config::from_env().region(region_provider).load().await;
let client = aws_sdk_dynamodb::Client::new(&config);
# }