pub struct DefaultCredentialsChain(_);
Expand description
Default AWS Credential Provider Chain
Resolution order:
- Environment variables:
EnvironmentVariableCredentialsProvider
- Shared config (
~/.aws/config
,~/.aws/credentials
):SharedConfigCredentialsProvider
- Web Identity Tokens
- ECS (IAM Roles for Tasks) & General HTTP credentials:
ecs
- EC2 IMDSv2
The outer provider is wrapped in a refreshing cache.
More providers are a work in progress.
Examples
Create a default chain with a custom region:
use aws_types::region::Region;
use aws_config::default_provider::credentials::DefaultCredentialsChain;
let credentials_provider = DefaultCredentialsChain::builder()
.region(Region::new("us-west-1"))
.build();
Create a default chain with no overrides:
use aws_config::default_provider::credentials::DefaultCredentialsChain;
let credentials_provider = DefaultCredentialsChain::builder().build();
Create a default chain that uses a different profile:
use aws_config::default_provider::credentials::DefaultCredentialsChain;
let credentials_provider = DefaultCredentialsChain::builder()
.profile_name("otherprofile")
.build();
Implementations
Trait Implementations
sourceimpl Debug for DefaultCredentialsChain
impl Debug for DefaultCredentialsChain
sourceimpl ProvideCredentials for DefaultCredentialsChain
impl ProvideCredentials for DefaultCredentialsChain
sourcefn provide_credentials<'a>(&'a self) -> ProvideCredentials<'a> where
Self: 'a,
fn provide_credentials<'a>(&'a self) -> ProvideCredentials<'a> where
Self: 'a,
Returns a future that provides credentials.
Auto Trait Implementations
impl !RefUnwindSafe for DefaultCredentialsChain
impl Send for DefaultCredentialsChain
impl Sync for DefaultCredentialsChain
impl Unpin for DefaultCredentialsChain
impl !UnwindSafe for DefaultCredentialsChain
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more