Crate aws_config
source ·Expand description
aws-config
provides implementations of region and 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:
SdkConfig
. SdkConfig
can be used configure an AWS service client.
§Examples
Load default SDK configuration:
use aws_config::BehaviorVersion;
mod aws_sdk_dynamodb {
let config = aws_config::load_defaults(BehaviorVersion::v2023_11_09()).await;
let client = aws_sdk_dynamodb::Client::new(&config);
Load SDK configuration with a region override:
let region_provider = RegionProviderChain::default_provider().or_else("us-east-1");
// Note: requires the `behavior-version-latest` feature enabled
let config = aws_config::from_env().region(region_provider).load().await;
let client = aws_sdk_dynamodb::Client::new(&config);
Override configuration after construction of SdkConfig
:
let sdk_config = aws_config::load_defaults(aws_config::BehaviorVersion::latest()).await;
let custom_credentials_provider = custom_provider(&sdk_config);
let dynamo_config = aws_sdk_dynamodb::config::Builder::from(&sdk_config)
.credentials_provider(custom_credentials_provider)
.build();
let client = aws_sdk_dynamodb::Client::from_conf(dynamo_config);
Modules§
- credential_process
credentials-process
Credentials Provider for external process - Providers that implement the default AWS provider chain
- Ecs Credentials Provider
- Providers that load configuration from environment variables
- Types for configuring identity caching.
- IMDSv2 Client, credential, and region provider
- Meta-providers that augment existing providers with new behavior
- Load configuration from AWS Profiles
- Configuration Options for Credential Providers
- Retry configuration
- sso
sso
SSO Credentials and Token providers - Stalled stream protection configuration
- Credential provider augmentation through the AWS Security Token Service (STS).
- Timeout configuration
- Load Credentials from Web Identity Tokens
Structs§
- App name that can be configured with an AWS SDK client to become part of the user agent string.
- Behavior major-version of the client
- Load default sources for all configuration with override support Load a cross-service
SdkConfig
from the environment - Error for when an app name doesn’t meet character requirements.
- The region to send requests to.
- AWS Shared Configuration
Functions§
- Create a config loader with the defaults for the given behavior version.
- from_env
behavior-version-latest
Create a config loader with the latest defaults. - Load default configuration with the given behavior version.
- load_from_env
behavior-version-latest
Load default configuration with the latest defaults.