Skip to content

Commit 0a12a1e

Browse files
authored
feat(credential-provider-imds): adjust static stability expiration to 5-10 mins (#3575)
1 parent d9f1522 commit 0a12a1e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

packages/credential-provider-imds/src/utils/getExtendedInstanceMetadataCredentials.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ describe("getExtendedInstanceMetadataCredentials()", () => {
2121
nowMock.mockRestore();
2222
});
2323

24-
it("should extend the expiration random time(~15 mins) from now", () => {
24+
it("should extend the expiration random time(5~10 mins) from now", () => {
2525
const anyDate: Date = "any date" as unknown as Date;
2626
(Math.random as jest.Mock).mockReturnValue(0.5);
2727
expect(getExtendedInstanceMetadataCredentials({ ...staticSecret, expiration: anyDate }, logger)).toEqual({
2828
...staticSecret,
2929
originalExpiration: anyDate,
30-
expiration: new Date("2022-02-22T00:17:30Z"),
30+
expiration: new Date("2022-02-22T00:07:30Z"),
3131
});
3232
expect(Math.random).toBeCalledTimes(1);
3333
});

packages/credential-provider-imds/src/utils/getExtendedInstanceMetadataCredentials.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Logger } from "@aws-sdk/types";
22

33
import { InstanceMetadataCredentials } from "../types";
44

5-
const STATIC_STABILITY_REFRESH_INTERVAL_SECONDS = 15 * 60;
5+
const STATIC_STABILITY_REFRESH_INTERVAL_SECONDS = 5 * 60;
66
const STATIC_STABILITY_REFRESH_INTERVAL_JITTER_WINDOW_SECONDS = 5 * 60;
77
const STATIC_STABILITY_DOC_URL = "https://docs.aws.amazon.com/sdkref/latest/guide/feature-static-credentials.html";
88

0 commit comments

Comments
 (0)