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_processcredentials-process
Credentials Provider for external process
default_provider
Providers that implement the default AWS provider chain
ecs
Ecs Credentials Provider
environment
Providers that load configuration from environment variables
identity
Types for configuring identity caching.
imds
IMDSv2 Client, credential, and region provider
meta
Meta-providers that augment existing providers with new behavior
profile
Load configuration from AWS Profiles
provider_config
Configuration Options for Credential Providers
retry
Retry configuration
ssosso
SSO Credentials and Token providers
stalled_stream_protection
Stalled stream protection configuration
sts
Credential provider augmentation through the AWS Security Token Service (STS).
timeout
Timeout configuration
web_identity_token
Load Credentials from Web Identity Tokens

Structs§

AppName
App name that can be configured with an AWS SDK client to become part of the user agent string.
BehaviorVersion
Behavior version of the client
ConfigLoader
Load default sources for all configuration with override support Load a cross-service SdkConfig from the environment
InvalidAppName
Error for when an app name doesn’t meet character requirements.
Region
The region to send requests to.
SdkConfig
AWS Shared Configuration

Functions§

defaults
Create a config loader with the defaults for the given behavior version.
from_envbehavior-version-latest
Create a config loader with the latest defaults.
load_defaults
Load default configuration with the given behavior version.
load_from_envbehavior-version-latest
Load default configuration with the latest defaults.