docbox_core/
aws.rs

1use aws_config::{BehaviorVersion, SdkConfig, meta::region::RegionProviderChain};
2
3pub type SqsClient = aws_sdk_sqs::Client;
4
5/// Create the AWS production configuration
6pub async fn aws_config() -> SdkConfig {
7    let region_provider = RegionProviderChain::default_provider()
8        // Fallback to our desired region
9        .or_else("ap-southeast-2");
10
11    // Load the configuration from env variables (See https://docs.aws.amazon.com/sdkref/latest/guide/settings-reference.html#EVarSettings)
12    aws_config::from_env()
13        // Setup the region provider
14        .region(region_provider)
15        .behavior_version(BehaviorVersion::v2025_08_07())
16        .load()
17        .await
18}
19
20/// Create the AWS production configuration using a specific AWS_PROFILE
21pub async fn aws_config_with_profile(profile_name: impl Into<String>) -> SdkConfig {
22    let region_provider = RegionProviderChain::default_provider()
23        // Fallback to our desired region
24        .or_else("ap-southeast-2");
25
26    // Load the configuration from env variables (See https://docs.aws.amazon.com/sdkref/latest/guide/settings-reference.html#EVarSettings)
27    aws_config::from_env()
28        // Setup the region provider
29        .region(region_provider)
30        .profile_name(profile_name)
31        .behavior_version(BehaviorVersion::v2025_08_07())
32        .load()
33        .await
34}