How to use @aws-sdk/credential-provider-imds - 2 common examples

To help you get started, we’ve selected a few @aws-sdk/credential-provider-imds examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aws / aws-sdk-js-v3 / packages / credential-provider-node / src / index.ts View on Github external
function remoteProvider(init: RemoteProviderInit): CredentialProvider {
  if (process.env[ENV_CMDS_RELATIVE_URI] || process.env[ENV_CMDS_FULL_URI]) {
    return fromContainerMetadata(init);
  }

  if (process.env[ENV_IMDS_DISABLED]) {
    return () =>
      Promise.reject(
        new ProviderError("EC2 Instance Metadata Service access disabled")
      );
  }

  return fromInstanceMetadata(init);
}
github aws / aws-sdk-js-v3 / packages / credential-provider-node / src / index.ts View on Github external
function remoteProvider(init: RemoteProviderInit): CredentialProvider {
  if (process.env[ENV_CMDS_RELATIVE_URI] || process.env[ENV_CMDS_FULL_URI]) {
    return fromContainerMetadata(init);
  }

  if (process.env[ENV_IMDS_DISABLED]) {
    return () =>
      Promise.reject(
        new ProviderError("EC2 Instance Metadata Service access disabled")
      );
  }

  return fromInstanceMetadata(init);
}

@aws-sdk/credential-provider-imds

AWS credential provider that sources credentials from the EC2 instance metadata service and ECS container metadata service

Apache-2.0
Latest version published 1 year ago

Package Health Score

72 / 100
Full package analysis