• Version 3.418.0
  • Published
  • 27.1 kB
  • 11 dependencies
  • Apache-2.0 license


npm i @aws-sdk/credential-provider-node
yarn add @aws-sdk/credential-provider-node
pnpm add @aws-sdk/credential-provider-node


AWS credential provider that sources credentials from a Node.JS environment.



function defaultProvider

defaultProvider: (
init?: DefaultProviderInit
) => MemoizedProvider<AwsCredentialIdentity>;
  • Creates a credential provider that will attempt to find credentials from the following sources (listed in order of precedence): * Environment variables exposed via process.env * SSO credentials from token cache * Web identity token credentials * Shared credentials and config ini files * The EC2/ECS Instance Metadata Service

    The default credential provider will invoke one provider at a time and only continue to the next if no credentials have been located. For example, if the process finds values defined via the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables, the files at ~/.aws/credentials and ~/.aws/config will not be read, nor will any messages be sent to the Instance Metadata Service.

    Parameter init

    Configuration that is passed to each individual provider

    See Also

    • fromEnv The function used to source credentials from environment variables

    • fromSSO The function used to source credentials from resolved SSO token cache

    • fromTokenFile The function used to source credentials from token file

    • fromIni The function used to source credentials from INI files

    • fromProcess The function used to sources credentials from credential_process in INI files

    • fromInstanceMetadata The function used to source credentials from the EC2 Instance Metadata Service

    • fromContainerMetadata The function used to source credentials from the ECS Container Metadata Service

Type Aliases

type DefaultProviderInit

type DefaultProviderInit = FromIniInit &
RemoteProviderInit &
FromProcessInit &
FromSSOInit &

    Package Files (2)

    Dependencies (11)

    Dev Dependencies (7)

    Peer Dependencies (0)

    No peer dependencies.


    To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

    You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@aws-sdk/credential-provider-node.

    • Markdown
    • HTML
      <a href="https://www.jsdocs.io/package/@aws-sdk/credential-provider-node"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>