Skip to content

Commit d138274

Browse files
Merge pull request #1981 from aws/staging/56041e2f-715e-44b1-a45e-644ef07e8386
Pull request: release <- staging/56041e2f-715e-44b1-a45e-644ef07e8386
2 parents 755a84a + 3a28827 commit d138274

File tree

370 files changed

+822
-405
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

370 files changed

+822
-405
lines changed

.changes/2.17.164.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"version": "2.17.164",
3+
"date": "2022-04-05",
4+
"entries": [
5+
{
6+
"type": "feature",
7+
"category": "AWS SDK for Java v2",
8+
"contributor": "",
9+
"description": "Bump CRT version to `0.16.1`."
10+
},
11+
{
12+
"type": "bugfix",
13+
"category": "AWS SDK for Java v2",
14+
"contributor": "",
15+
"description": "Refresh IMDS credentials more aggressively."
16+
},
17+
{
18+
"type": "feature",
19+
"category": "AWS S3 Control",
20+
"contributor": "",
21+
"description": "Documentation-only update for doc bug fixes for the S3 Control API docs."
22+
},
23+
{
24+
"type": "feature",
25+
"category": "AWS SecurityHub",
26+
"contributor": "",
27+
"description": "Added additional ASFF details for RdsSecurityGroup AutoScalingGroup, ElbLoadBalancer, CodeBuildProject and RedshiftCluster."
28+
},
29+
{
30+
"type": "feature",
31+
"category": "AWS DataSync",
32+
"contributor": "",
33+
"description": "AWS DataSync now supports Amazon FSx for OpenZFS locations."
34+
},
35+
{
36+
"type": "feature",
37+
"category": "Amazon FSx",
38+
"contributor": "",
39+
"description": "Provide customers more visibility into file system status by adding new \"Misconfigured Unavailable\" status for Amazon FSx for Windows File Server."
40+
}
41+
]
42+
}

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
# __2.17.164__ __2022-04-05__
2+
## __AWS DataSync__
3+
- ### Features
4+
- AWS DataSync now supports Amazon FSx for OpenZFS locations.
5+
6+
## __AWS S3 Control__
7+
- ### Features
8+
- Documentation-only update for doc bug fixes for the S3 Control API docs.
9+
10+
## __AWS SDK for Java v2__
11+
- ### Features
12+
- Bump CRT version to `0.16.1`.
13+
14+
- ### Bugfixes
15+
- Refresh IMDS credentials more aggressively.
16+
17+
## __AWS SecurityHub__
18+
- ### Features
19+
- Added additional ASFF details for RdsSecurityGroup AutoScalingGroup, ElbLoadBalancer, CodeBuildProject and RedshiftCluster.
20+
21+
## __Amazon FSx__
22+
- ### Features
23+
- Provide customers more visibility into file system status by adding new "Misconfigured Unavailable" status for Amazon FSx for Windows File Server.
24+
125
# __2.17.163__ __2022-04-04__
226
## __AWS IoT__
327
- ### Features

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ To automatically manage module versions (currently all modules have the same ver
5252
<dependency>
5353
<groupId>software.amazon.awssdk</groupId>
5454
<artifactId>bom</artifactId>
55-
<version>2.17.163</version>
55+
<version>2.17.164</version>
5656
<type>pom</type>
5757
<scope>import</scope>
5858
</dependency>
@@ -86,12 +86,12 @@ Alternatively you can add dependencies for the specific services you use only:
8686
<dependency>
8787
<groupId>software.amazon.awssdk</groupId>
8888
<artifactId>ec2</artifactId>
89-
<version>2.17.163</version>
89+
<version>2.17.164</version>
9090
</dependency>
9191
<dependency>
9292
<groupId>software.amazon.awssdk</groupId>
9393
<artifactId>s3</artifactId>
94-
<version>2.17.163</version>
94+
<version>2.17.164</version>
9595
</dependency>
9696
```
9797

@@ -103,7 +103,7 @@ You can import the whole SDK into your project (includes *ALL* services). Please
103103
<dependency>
104104
<groupId>software.amazon.awssdk</groupId>
105105
<artifactId>aws-sdk-java</artifactId>
106-
<version>2.17.163</version>
106+
<version>2.17.164</version>
107107
</dependency>
108108
```
109109

archetypes/archetype-app-quickstart/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<parent>
2121
<artifactId>archetypes</artifactId>
2222
<groupId>software.amazon.awssdk</groupId>
23-
<version>2.17.163</version>
23+
<version>2.17.164</version>
2424
</parent>
2525
<modelVersion>4.0.0</modelVersion>
2626

archetypes/archetype-lambda/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<parent>
2121
<artifactId>archetypes</artifactId>
2222
<groupId>software.amazon.awssdk</groupId>
23-
<version>2.17.163</version>
23+
<version>2.17.164</version>
2424
</parent>
2525
<modelVersion>4.0.0</modelVersion>
2626
<artifactId>archetype-lambda</artifactId>

archetypes/archetype-tools/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<parent>
2121
<artifactId>archetypes</artifactId>
2222
<groupId>software.amazon.awssdk</groupId>
23-
<version>2.17.163</version>
23+
<version>2.17.164</version>
2424
</parent>
2525
<modelVersion>4.0.0</modelVersion>
2626

archetypes/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<parent>
2121
<artifactId>aws-sdk-java-pom</artifactId>
2222
<groupId>software.amazon.awssdk</groupId>
23-
<version>2.17.163</version>
23+
<version>2.17.164</version>
2424
</parent>
2525
<modelVersion>4.0.0</modelVersion>
2626
<artifactId>archetypes</artifactId>

aws-sdk-java/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<parent>
1818
<groupId>software.amazon.awssdk</groupId>
1919
<artifactId>aws-sdk-java-pom</artifactId>
20-
<version>2.17.163</version>
20+
<version>2.17.164</version>
2121
<relativePath>../pom.xml</relativePath>
2222
</parent>
2323
<artifactId>aws-sdk-java</artifactId>

bom-internal/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<parent>
2121
<artifactId>aws-sdk-java-pom</artifactId>
2222
<groupId>software.amazon.awssdk</groupId>
23-
<version>2.17.163</version>
23+
<version>2.17.164</version>
2424
</parent>
2525
<modelVersion>4.0.0</modelVersion>
2626

bom/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<parent>
1818
<groupId>software.amazon.awssdk</groupId>
1919
<artifactId>aws-sdk-java-pom</artifactId>
20-
<version>2.17.163</version>
20+
<version>2.17.164</version>
2121
<relativePath>../pom.xml</relativePath>
2222
</parent>
2323
<artifactId>bom</artifactId>

bundle/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<parent>
2222
<groupId>software.amazon.awssdk</groupId>
2323
<artifactId>aws-sdk-java-pom</artifactId>
24-
<version>2.17.163</version>
24+
<version>2.17.164</version>
2525
</parent>
2626
<artifactId>bundle</artifactId>
2727
<packaging>jar</packaging>

codegen-lite-maven-plugin/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<parent>
2323
<groupId>software.amazon.awssdk</groupId>
2424
<artifactId>aws-sdk-java-pom</artifactId>
25-
<version>2.17.163</version>
25+
<version>2.17.164</version>
2626
<relativePath>../pom.xml</relativePath>
2727
</parent>
2828
<artifactId>codegen-lite-maven-plugin</artifactId>

codegen-lite/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<parent>
2222
<groupId>software.amazon.awssdk</groupId>
2323
<artifactId>aws-sdk-java-pom</artifactId>
24-
<version>2.17.163</version>
24+
<version>2.17.164</version>
2525
</parent>
2626
<artifactId>codegen-lite</artifactId>
2727
<name>AWS Java SDK :: Code Generator Lite</name>

codegen-maven-plugin/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<parent>
2323
<groupId>software.amazon.awssdk</groupId>
2424
<artifactId>aws-sdk-java-pom</artifactId>
25-
<version>2.17.163</version>
25+
<version>2.17.164</version>
2626
<relativePath>../pom.xml</relativePath>
2727
</parent>
2828
<artifactId>codegen-maven-plugin</artifactId>

codegen/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<parent>
2222
<groupId>software.amazon.awssdk</groupId>
2323
<artifactId>aws-sdk-java-pom</artifactId>
24-
<version>2.17.163</version>
24+
<version>2.17.164</version>
2525
</parent>
2626
<artifactId>codegen</artifactId>
2727
<name>AWS Java SDK :: Code Generator</name>

core/annotations/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<parent>
2121
<artifactId>core</artifactId>
2222
<groupId>software.amazon.awssdk</groupId>
23-
<version>2.17.163</version>
23+
<version>2.17.164</version>
2424
</parent>
2525
<modelVersion>4.0.0</modelVersion>
2626

core/arns/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<parent>
2121
<artifactId>core</artifactId>
2222
<groupId>software.amazon.awssdk</groupId>
23-
<version>2.17.163</version>
23+
<version>2.17.164</version>
2424
</parent>
2525
<modelVersion>4.0.0</modelVersion>
2626

core/auth-crt/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<parent>
2323
<groupId>software.amazon.awssdk</groupId>
2424
<artifactId>core</artifactId>
25-
<version>2.17.163</version>
25+
<version>2.17.164</version>
2626
</parent>
2727

2828
<artifactId>auth-crt</artifactId>

core/auth/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<parent>
2323
<groupId>software.amazon.awssdk</groupId>
2424
<artifactId>core</artifactId>
25-
<version>2.17.163</version>
25+
<version>2.17.164</version>
2626
</parent>
2727

2828
<artifactId>auth</artifactId>

core/auth/src/main/java/software/amazon/awssdk/auth/credentials/InstanceProfileCredentialsProvider.java

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515

1616
package software.amazon.awssdk.auth.credentials;
1717

18-
import static java.time.temporal.ChronoUnit.HOURS;
1918
import static java.time.temporal.ChronoUnit.MINUTES;
19+
import static java.time.temporal.ChronoUnit.SECONDS;
20+
import static software.amazon.awssdk.utils.ComparableUtils.minimum;
2021

2122
import java.io.IOException;
2223
import java.net.URI;
@@ -156,24 +157,39 @@ private boolean isLocalCredentialLoadingDisabled() {
156157

157158
private Instant prefetchTime(Instant expiration) {
158159
Instant now = clock.instant();
159-
Instant oneHourFromNow = now.plus(1, HOURS);
160160

161-
// If expiration time is infinite or farther out than an hour, wait an hour before refreshing
162-
if (expiration == null || expiration.isAfter(oneHourFromNow)) {
163-
return oneHourFromNow;
161+
// If expiration time doesn't exist, refresh in 60 minutes
162+
if (expiration == null) {
163+
return now.plus(60, MINUTES);
164164
}
165165

166-
// If expiration time is within 15 minutes (or in the past), wait 15 minutes and warn the customer that they'll be using
167-
// expired credentials.
168-
Instant fifteenMinutesFromNow = now.plus(15, MINUTES);
169-
if (expiration.isBefore(fifteenMinutesFromNow)) {
170-
log.warn(() -> "IMDS credential expiration has been extended due to an IMDS availability outage. A refresh"
171-
+ " of these credentials will be attempted again in 15 minutes.");
172-
return fifteenMinutesFromNow;
166+
// If expiration time is 60+ minutes from now, refresh in 60 minutes or 60 minutes before expiration, whichever is
167+
// sooner. This is the average case, where customers are using IMDS and there is no IMDS outage.
168+
Instant sixtyMinutesBeforeExpiration = expiration.minus(60, MINUTES);
169+
if (now.isBefore(sixtyMinutesBeforeExpiration)) {
170+
return minimum(sixtyMinutesBeforeExpiration, now.plus(60, MINUTES));
173171
}
174172

175-
// Otherwise, just refresh 15 minutes before the credentials expire.
176-
return expiration.minus(15, MINUTES);
173+
// If expiration time is 5-60 minutes from now, refresh in 30 minutes or 5 minutes before expiration, whatever is
174+
// sooner. This is an unusual case: IMDS is either having an outage or the customer is using a mock IMDS with shorter
175+
// default session durations.
176+
Instant fiveMinutesBeforeExpiration = expiration.minus(5, MINUTES);
177+
if (now.isBefore(fiveMinutesBeforeExpiration)) {
178+
return minimum(fiveMinutesBeforeExpiration, now.plus(30, MINUTES));
179+
}
180+
181+
// If expiration time is 0.25-5 minutes from now, refresh 15 seconds before expiration. This is an unusual case: IMDS is
182+
// either having an outage or the customer is using a mock IMDS with very aggressive session durations.
183+
Instant fifteenSecondsBeforeExpiration = expiration.minus(15, SECONDS);
184+
if (now.isBefore(fifteenSecondsBeforeExpiration)) {
185+
return fifteenSecondsBeforeExpiration;
186+
}
187+
188+
// These credentials are expired. Try refreshing again in 5 minutes. We can't be more aggressive than that, because we
189+
// don't want to overload the IMDS endpoint.
190+
log.warn(() -> "IMDS credential expiration has been extended due to an IMDS availability outage. A refresh "
191+
+ "of these credentials will be attempted again in 5 minutes.");
192+
return now.plus(5, MINUTES);
177193
}
178194

179195
@Override

core/auth/src/test/java/software/amazon/awssdk/auth/credentials/InstanceProfileCredentialsProviderTest.java

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
2525
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
2626
import static java.time.temporal.ChronoUnit.HOURS;
27+
import static java.time.temporal.ChronoUnit.MINUTES;
28+
import static java.time.temporal.ChronoUnit.SECONDS;
2729
import static org.assertj.core.api.Assertions.assertThat;
2830
import static org.assertj.core.api.Assertions.assertThatThrownBy;
2931

@@ -335,6 +337,46 @@ public void resolveCredentials_usesCacheIfImdsFailsOnSecondCall() {
335337
assertThat(credentialsBefore).isEqualTo(credentialsAfter);
336338
}
337339

340+
@Test
341+
public void resolveCredentials_callsImdsIfCredentialsWithin5MinutesOfExpiration() {
342+
AdjustableClock clock = new AdjustableClock();
343+
AwsCredentialsProvider credentialsProvider = credentialsProviderWithClock(clock);
344+
Instant now = Instant.now();
345+
String successfulCredentialsResponse1 =
346+
"{"
347+
+ "\"AccessKeyId\":\"ACCESS_KEY_ID\","
348+
+ "\"SecretAccessKey\":\"SECRET_ACCESS_KEY\","
349+
+ "\"Expiration\":\"" + DateUtils.formatIso8601Date(now) + '"'
350+
+ "}";
351+
352+
String successfulCredentialsResponse2 =
353+
"{"
354+
+ "\"AccessKeyId\":\"ACCESS_KEY_ID\","
355+
+ "\"SecretAccessKey\":\"SECRET_ACCESS_KEY2\","
356+
+ "\"Expiration\":\"" + DateUtils.formatIso8601Date(now.plus(6, HOURS)) + '"'
357+
+ "}";
358+
359+
// Set the time to the past and call IMDS to prime the cache
360+
clock.time = now.minus(24, HOURS);
361+
stubCredentialsResponse(aResponse().withBody(successfulCredentialsResponse1));
362+
AwsCredentials credentials24HoursAgo = credentialsProvider.resolveCredentials();
363+
364+
// Set the time to 3 minutes before expiration, and fail to call IMDS
365+
clock.time = now.minus(3, MINUTES);
366+
stubCredentialsResponse(aResponse().withStatus(500));
367+
AwsCredentials credentials3MinutesAgo = credentialsProvider.resolveCredentials();
368+
369+
// Set the time to 10 seconds before expiration, and verify that we still call IMDS to try to get credentials in at the
370+
// last moment before expiration
371+
clock.time = now.minus(10, SECONDS);
372+
stubCredentialsResponse(aResponse().withBody(successfulCredentialsResponse2));
373+
AwsCredentials credentials10SecondsAgo = credentialsProvider.resolveCredentials();
374+
375+
assertThat(credentials24HoursAgo).isEqualTo(credentials3MinutesAgo);
376+
assertThat(credentials24HoursAgo.secretAccessKey()).isEqualTo("SECRET_ACCESS_KEY");
377+
assertThat(credentials10SecondsAgo.secretAccessKey()).isEqualTo("SECRET_ACCESS_KEY2");
378+
}
379+
338380
private AwsCredentialsProvider credentialsProviderWithClock(Clock clock) {
339381
InstanceProfileCredentialsProvider.BuilderImpl builder =
340382
(InstanceProfileCredentialsProvider.BuilderImpl) InstanceProfileCredentialsProvider.builder();

core/aws-core/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<parent>
2323
<groupId>software.amazon.awssdk</groupId>
2424
<artifactId>core</artifactId>
25-
<version>2.17.163</version>
25+
<version>2.17.164</version>
2626
</parent>
2727

2828
<artifactId>aws-core</artifactId>

core/json-utils/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<parent>
2121
<artifactId>core</artifactId>
2222
<groupId>software.amazon.awssdk</groupId>
23-
<version>2.17.163</version>
23+
<version>2.17.164</version>
2424
</parent>
2525
<modelVersion>4.0.0</modelVersion>
2626

core/metrics-spi/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>core</artifactId>
77
<groupId>software.amazon.awssdk</groupId>
8-
<version>2.17.163</version>
8+
<version>2.17.164</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

0 commit comments

Comments
 (0)