3.67.0 • Published 3 years ago

@trivikr-test/credential-provider-node-esm-wrapper v3.67.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
3 years ago

@aws-sdk/credential-provider-node

NPM version NPM downloads

AWS Credential Provider for Node.JS

This module provides a factory function, fromEnv, that will attempt to source AWS credentials from a Node.JS environment. It 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.

If invalid configuration is encountered (such as a profile in ~/.aws/credentials specifying as its source_profile the name of a profile that does not exist), then the chained provider will be rejected with an error and will not invoke the next provider in the list.

IMPORTANT: if you intend for your code to run using EKS roles at some point (for example in a production environment, but not when working locally) then you must explicitly specify a value for roleAssumerWithWebIdentity. There is a default function available in @aws-sdk/client-sts package. An example of using this:

const { getDefaultRoleAssumerWithWebIdentity } = require("@aws-sdk/client-sts");
const { defaultProvider } = require("@aws-sdk/credential-provider-node");
const { S3Client, GetObjectCommand } = require("@aws-sdk/client-s3");

const provider = defaultProvider({
  roleAssumerWithWebIdentity: getDefaultRoleAssumerWithWebIdentity,
});

const client = new S3Client({ credentialDefaultProvider: provider });

Supported configuration

You may customize how credentials are resolved by providing an options hash to the defaultProvider factory function. The following options are supported:

  • profile - The configuration profile to use. If not specified, the provider will use the value in the AWS_PROFILE environment variable or a default of default.
  • filepath - The path to the shared credentials file. If not specified, the provider will use the value in the AWS_SHARED_CREDENTIALS_FILE environment variable or a default of ~/.aws/credentials.
  • configFilepath - The path to the shared config file. If not specified, the provider will use the value in the AWS_CONFIG_FILE environment variable or a default of ~/.aws/config.
  • mfaCodeProvider - A function that returns a a promise fulfilled with an MFA token code for the provided MFA Serial code. If a profile requires an MFA code and mfaCodeProvider is not a valid function, the credential provider promise will be rejected.
  • roleAssumer - A function that assumes a role and returns a promise fulfilled with credentials for the assumed role. If not specified, the SDK will create an STS client and call its assumeRole method.
  • roleArn - ARN to assume. If not specified, the provider will use the value in the AWS_ROLE_ARN environment variable.
  • webIdentityTokenFile - File location of where the OIDC token is stored. If not specified, the provider will use the value in the AWS_WEB_IDENTITY_TOKEN_FILE environment variable.
  • roleAssumerWithWebIdentity - A function that assumes a role with web identity and returns a promise fulfilled with credentials for the assumed role.
  • timeout - The connection timeout (in milliseconds) to apply to any remote requests. If not specified, a default value of 1000 (one second) is used.
  • maxRetries - The maximum number of times any HTTP connections should be retried. If not specified, a default value of 0 will be used.

Related packages:

@infinitebrahmanuniverse/nolb-_trivikr-test_c@everything-registry/sub-chunk-934@trivikr-test/client-sms-esm-wrapper@trivikr-test/client-health-esm-wrapper@trivikr-test/client-inspector2-esm-wrapper@trivikr-test/client-iot-1click-devices-service-esm-wrapper@trivikr-test/client-iot-1click-projects-esm-wrapper@trivikr-test/client-lookoutequipment-esm-wrapper@trivikr-test/client-lookoutmetrics-esm-wrapper@trivikr-test/client-apigatewaymanagementapi-esm-wrapper@trivikr-test/client-apigatewayv2-esm-wrapper@trivikr-test/client-app-mesh-esm-wrapper@trivikr-test/client-appconfig-esm-wrapper@trivikr-test/client-appconfigdata-esm-wrapper@trivikr-test/client-appflow-esm-wrapper@trivikr-test/client-appintegrations-esm-wrapper@trivikr-test/client-appstream-esm-wrapper@trivikr-test/client-athena-esm-wrapper@trivikr-test/client-auto-scaling-esm-wrapper@trivikr-test/client-auto-scaling-plans-esm-wrapper@trivikr-test/client-backup-esm-wrapper@trivikr-test/client-backup-gateway-esm-wrapper@trivikr-test/client-chime-sdk-identity-esm-wrapper@trivikr-test/client-chime-sdk-meetings-esm-wrapper@trivikr-test/client-chime-sdk-messaging-esm-wrapper@trivikr-test/client-cloud9-esm-wrapper@trivikr-test/client-cloudcontrol-esm-wrapper@trivikr-test/client-clouddirectory-esm-wrapper@trivikr-test/client-cloudformation-esm-wrapper@trivikr-test/client-cloudfront-esm-wrapper@trivikr-test/client-cloudhsm-esm-wrapper@trivikr-test/client-amplifybackend-esm-wrapper@trivikr-test/client-amplifyuibuilder-esm-wrapper@trivikr-test/client-api-gateway-esm-wrapper@trivikr-test/client-application-auto-scaling-esm-wrapper@trivikr-test/client-application-discovery-service-esm-wrapper@trivikr-test/client-application-insights-esm-wrapper@trivikr-test/client-applicationcostprofiler-esm-wrapper@trivikr-test/client-apprunner-esm-wrapper@trivikr-test/client-appsync-esm-wrapper@trivikr-test/client-auditmanager-esm-wrapper@trivikr-test/client-batch-esm-wrapper@trivikr-test/client-billingconductor-esm-wrapper@trivikr-test/client-braket-esm-wrapper@trivikr-test/client-budgets-esm-wrapper@trivikr-test/client-chime-esm-wrapper@trivikr-test/client-accessanalyzer-esm-wrapper@trivikr-test/client-account-esm-wrapper@trivikr-test/client-acm-esm-wrapper@trivikr-test/client-acm-pca-esm-wrapper@trivikr-test/client-alexa-for-business-esm-wrapper@trivikr-test/client-amp-esm-wrapper@trivikr-test/client-amplify-esm-wrapper@trivikr-test/client-codestar-connections-esm-wrapper@trivikr-test/client-codestar-esm-wrapper@trivikr-test/client-codestar-notifications-esm-wrapper@trivikr-test/client-cognito-identity-esm-wrapper@trivikr-test/client-cognito-identity-provider-esm-wrapper@trivikr-test/client-cognito-sync-esm-wrapper@trivikr-test/client-comprehend-esm-wrapper@trivikr-test/client-comprehendmedical-esm-wrapper@trivikr-test/client-compute-optimizer-esm-wrapper@trivikr-test/client-config-service-esm-wrapper@trivikr-test/client-dax-esm-wrapper@trivikr-test/client-detective-esm-wrapper@trivikr-test/client-device-farm-esm-wrapper@trivikr-test/client-devops-guru-esm-wrapper@trivikr-test/client-direct-connect-esm-wrapper@trivikr-test/client-directory-service-esm-wrapper@trivikr-test/client-dlm-esm-wrapper@trivikr-test/client-docdb-esm-wrapper@trivikr-test/client-drs-esm-wrapper@trivikr-test/client-dynamodb-esm-wrapper@trivikr-test/client-dynamodb-streams-esm-wrapper@trivikr-test/client-cloudhsm-v2-esm-wrapper@trivikr-test/client-cloudsearch-domain-esm-wrapper@trivikr-test/client-cloudsearch-esm-wrapper@trivikr-test/client-cloudtrail-esm-wrapper@trivikr-test/client-cloudwatch-events-esm-wrapper@trivikr-test/client-cloudwatch-logs-esm-wrapper@trivikr-test/client-codepipeline-esm-wrapper@trivikr-test/client-connectparticipant-esm-wrapper@trivikr-test/client-cost-and-usage-report-service-esm-wrapper@trivikr-test/client-cost-explorer-esm-wrapper@trivikr-test/client-cloudwatch-esm-wrapper@trivikr-test/client-codeartifact-esm-wrapper@trivikr-test/client-codebuild-esm-wrapper@trivikr-test/client-codecommit-esm-wrapper@trivikr-test/client-codedeploy-esm-wrapper@trivikr-test/client-codeguru-reviewer-esm-wrapper@trivikr-test/client-codeguruprofiler-esm-wrapper@trivikr-test/client-customer-profiles-esm-wrapper@trivikr-test/client-data-pipeline-esm-wrapper@trivikr-test/client-database-migration-service-esm-wrapper@trivikr-test/client-databrew-esm-wrapper@trivikr-test/client-dataexchange-esm-wrapper@trivikr-test/client-datasync-esm-wrapper@trivikr-test/client-connect-contact-lens-esm-wrapper@trivikr-test/client-connect-esm-wrapper@trivikr-test/client-ebs-esm-wrapper
3.67.0

3 years ago