From db0629fb799a568d073aa2c5ae73a05d23df842a Mon Sep 17 00:00:00 2001 From: "Kamat, Trivikram" <16024985+trivikr@users.noreply.github.com> Date: Fri, 20 Oct 2023 08:25:44 -0700 Subject: [PATCH] Support EC2MetadataCredentials --- .../v2-to-v3/__fixtures__/credentials/ec2-metadata.input.js | 3 +++ .../v2-to-v3/__fixtures__/credentials/ec2-metadata.output.js | 3 +++ src/transforms/v2-to-v3/config/AWS_CREDENTIALS_MAP.ts | 1 + 3 files changed, 7 insertions(+) create mode 100644 src/transforms/v2-to-v3/__fixtures__/credentials/ec2-metadata.input.js create mode 100644 src/transforms/v2-to-v3/__fixtures__/credentials/ec2-metadata.output.js diff --git a/src/transforms/v2-to-v3/__fixtures__/credentials/ec2-metadata.input.js b/src/transforms/v2-to-v3/__fixtures__/credentials/ec2-metadata.input.js new file mode 100644 index 000000000..cb9ab2a08 --- /dev/null +++ b/src/transforms/v2-to-v3/__fixtures__/credentials/ec2-metadata.input.js @@ -0,0 +1,3 @@ +import AWS from "aws-sdk"; + +const credentials = new AWS.EC2MetadataCredentials(); \ No newline at end of file diff --git a/src/transforms/v2-to-v3/__fixtures__/credentials/ec2-metadata.output.js b/src/transforms/v2-to-v3/__fixtures__/credentials/ec2-metadata.output.js new file mode 100644 index 000000000..ea013c028 --- /dev/null +++ b/src/transforms/v2-to-v3/__fixtures__/credentials/ec2-metadata.output.js @@ -0,0 +1,3 @@ +import { fromInstanceMetadata } from "@aws-sdk/credential-providers"; + +const credentials = fromInstanceMetadata(); \ No newline at end of file diff --git a/src/transforms/v2-to-v3/config/AWS_CREDENTIALS_MAP.ts b/src/transforms/v2-to-v3/config/AWS_CREDENTIALS_MAP.ts index 5e9ea9638..55f1e2f54 100644 --- a/src/transforms/v2-to-v3/config/AWS_CREDENTIALS_MAP.ts +++ b/src/transforms/v2-to-v3/config/AWS_CREDENTIALS_MAP.ts @@ -2,6 +2,7 @@ * Maps the AWS credentials class name in v2 to the v3 equivalent provider. */ export const AWS_CREDENTIALS_MAP: Record = { + EC2MetadataCredentials: "fromInstanceMetadata", EnvironmentCredentials: "fromEnv", ChainableTemporaryCredentials: "fromTemporaryCredentials", };