Skip to content
This repository was archived by the owner on Jan 19, 2022. It is now read-only.

Commit fb4fcb5

Browse files
Merge remote-tracking branch 'origin/2.3.x' into gh-655-polish2
2 parents e790ae6 + 12ddfc8 commit fb4fcb5

File tree

45 files changed

+1798
-81
lines changed

Some content is hidden

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

45 files changed

+1798
-81
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
name: "Test with ${{ matrix.version }}"
1414
strategy:
1515
matrix:
16-
version: [ 8.0.272.hs-adpt ]
16+
version: [ 8.0.275.hs-adpt ]
1717
runs-on: ubuntu-latest
1818
steps:
1919
- uses: actions/checkout@v2

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
name: "Release"
1313
strategy:
1414
matrix:
15-
version: [ 8.0.272.hs-adpt ]
15+
version: [ 8.0.275.hs-adpt ]
1616
runs-on: ubuntu-latest
1717
steps:
1818
- uses: actions/checkout@v2

.github/workflows/upload-docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
restore-keys: |
2424
${{ runner.os }}-maven-
2525
- name: Build docs
26-
run: ./mvnw -pl docs clean package -Pdocs
26+
run: ./mvnw clean package -Pdocs,spring -DskipTests=true
2727
- name: Upload to S3
2828
env:
2929
AWS_ACCESS_KEY_ID: ${{ secrets.S3_AWS_ACCESS_KEY }}

docs/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<docs.main>spring-cloud-aws</docs.main>
3333
<main.basedir>${basedir}/..</main.basedir>
3434
<docs.whitelisted.branches>2.1.x,2.2.x,2.3.x</docs.whitelisted.branches>
35-
<configprops.inclusionPattern>cloud.aws.*|aws.*</configprops.inclusionPattern>
35+
<configprops.inclusionPattern>cloud.aws.*|aws.*|spring.cloud.aws.*</configprops.inclusionPattern>
3636
<upload-docs-zip.phase>deploy</upload-docs-zip.phase>
3737
<generated-docs-multipage-output.dir>${project.build.directory}/generated-docs/${project.version}/reference/html</generated-docs-multipage-output.dir>
3838
<generated-docs-singlepage-output.dir>${project.build.directory}/generated-docs/${project.version}/reference/htmlsingle</generated-docs-singlepage-output.dir>

docs/src/main/asciidoc/_configprops.adoc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
|cloud.aws.elasticache.default-expiration | `0` | Configures the default expiration time in seconds if there is no custom expiration time configuration with a {@link Cluster} configuration for the cache. The expiration time is implementation specific (e.g. Redis or Memcached) and could therefore differ in the behaviour based on the cache implementation.
2828
|cloud.aws.elasticache.enabled | `true` | Enables ElastiCache integration.
2929
|cloud.aws.elasticache.expiry-time-per-cache | |
30+
|cloud.aws.instance.data.enabled | `false` | Enables Instance Data integration.
3031
|cloud.aws.loader.core-pool-size | `1` | The core pool size of the Task Executor used for parallel S3 interaction. @see org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#setCorePoolSize(int)
3132
|cloud.aws.loader.max-pool-size | | The maximum pool size of the Task Executor used for parallel S3 interaction. @see org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#setMaxPoolSize(int)
3233
|cloud.aws.loader.queue-capacity | | The maximum queue capacity for backed up S3 requests. @see org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#setQueueCapacity(int)
@@ -56,5 +57,12 @@
5657
|cloud.aws.stack.auto | `true` | Enables the automatic stack name detection for the application.
5758
|cloud.aws.stack.enabled | `true` | Enables Stack integration.
5859
|cloud.aws.stack.name | | The name of the manually configured stack name that will be used to retrieve the resources.
60+
|spring.cloud.aws.security.cognito.algorithm | `RS256` | Encryption algorithm used to sign the JWK token.
61+
|spring.cloud.aws.security.cognito.app-client-id | | Non-dynamic audience string to validate.
62+
|spring.cloud.aws.security.cognito.enabled | `true` | Enables Cognito integration.
63+
|spring.cloud.aws.security.cognito.region | |
64+
|spring.cloud.aws.security.cognito.user-pool-id | |
65+
|spring.cloud.aws.ses.enabled | `true` | Enables Simple Email Service integration.
66+
|spring.cloud.aws.ses.region | | Overrides the default region.
5967

6068
|===

docs/src/main/asciidoc/cloudformation.adoc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,18 @@ template file and creates all resources with their _physical name_. The applicat
1515
with the _logical name_ defined in the template. Spring Cloud AWS resolves all _logical names_ into the respective
1616
_physical name_ for the application developer.
1717

18+
=== Dependencies
19+
20+
To enable CloudFormation support in Spring Cloud AWS you must add following dependency that will trigger `ContextStackAutoConfiguration`:
21+
22+
[source,xml,indent=0]
23+
----
24+
<dependency>
25+
<groupId>com.amazonaws</groupId>
26+
<artifactId>aws-java-sdk-cloudformation</artifactId>
27+
</dependency>
28+
----
29+
1830
=== Automatic CloudFormation configuration
1931
If the application runs inside a stack (because the underlying EC2 instance has been bootstrapped within the stack), then
2032
Spring Cloud AWS will automatically detect the stack and resolve all resources from the stack. Application developers

docs/src/main/asciidoc/s3.adoc

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ to load and write resources with the resource loader and the `s3` protocol.
66
The resource loader is part of the context module, therefore no additional dependencies are necessary to use the resource
77
handling support.
88

9-
=== Configuring the resource loader
9+
=== Configuring the resource loader with Spring Boot
10+
11+
Resource loader is enabled by default when `spring-cloud-starter-aws` is added as the dependency.
12+
13+
=== Configuring the resource loader with XML
1014
Spring Cloud AWS does not modify the default resource loader unless it encounters an explicit configuration with an XML namespace element.
1115
The configuration consists of one element for the whole application context that is shown below:
1216

@@ -106,13 +110,15 @@ This example shows the use of the `transferManager` within an application to upl
106110

107111
[source,java,indent=0]
108112
----
109-
public class SimpleResourceLoadingBean {
113+
public class SimpleResourceUploadingBean {
110114
111115
@Autowired
112116
private AmazonS3 amazonS3;
113117
114118
public void withTransferManager() {
115-
TransferManager transferManager = new TransferManager(this.amazonS3);
119+
TransferManager transferManager = TransferManagerBuilder.standard()
120+
.withS3Client(this.amazonS3)
121+
.build();
116122
transferManager.upload("myBucket","filename",new File("someFile"));
117123
}
118124
}
@@ -192,3 +198,45 @@ public class SimpleResourceLoadingBean {
192198
}
193199
}
194200
----
201+
202+
=== IAM Permissions
203+
red
204+
Following IAM permissions are required by Spring Cloud AWS:
205+
206+
[cols="2"]
207+
|===
208+
| Downloading files
209+
| `s3:GetObject`
210+
211+
| Searching files
212+
| `s3:ListObjects`
213+
214+
| Uploading files
215+
| `s3:PutObject`
216+
|===
217+
218+
Sample IAM policy granting access to `spring-cloud-aws-demo` bucket:
219+
220+
[source,json,indent=0]
221+
----
222+
{
223+
"Version": "2012-10-17",
224+
"Statement": [
225+
{
226+
"Effect": "Allow",
227+
"Action": "s3:ListBucket",
228+
"Resource": "arn:aws:s3:::spring-cloud-aws-demo"
229+
},
230+
{
231+
"Effect": "Allow",
232+
"Action": "s3:GetObject",
233+
"Resource": "arn:aws:s3:::spring-cloud-aws-demo/*"
234+
},
235+
{
236+
"Effect": "Allow",
237+
"Action": "s3:PutObject",
238+
"Resource": "arn:aws:s3:::spring-cloud-aws-demo/*"
239+
}
240+
]
241+
}
242+
----

docs/src/main/asciidoc/ses.adoc

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,57 @@ an SES service where the client is overridden to use a valid region (EU-WEST-1).
142142
</beans>
143143
----
144144

145+
Since 2.3, if using spring-boot, the existing auto-configuration offers a specific configuration property to set the
146+
region for the SES client.
147+
148+
[source,properties,indent=0]
149+
----
150+
cloud.aws.mail.region=eu-west-1
151+
----
152+
153+
Also, there is a new starter `spring-cloud-starter-aws-ses` and it offers a specific configuration property.
154+
155+
[source,properties,indent=0]
156+
----
157+
spring.cloud.aws.ses.region=eu-west-1
158+
----
159+
145160
=== Authenticating e-mails
146161
To avoid any spam attacks on the Amazon SES mail service, applications without production access must
147162
https://docs.aws.amazon.com/ses/latest/DeveloperGuide/verify-email-addresses.html[verify] each
148163
e-mail receiver otherwise the mail sender will throw a `com.amazonaws.services.simpleemail.model.MessageRejectedException`.
149164

150165
https://docs.aws.amazon.com/ses/latest/DeveloperGuide/request-production-access.html[Production access] can be requested
151166
and will disable the need for mail address verification.
167+
168+
=== IAM Permissions
169+
Following IAM permissions are required by Spring Cloud AWS:
170+
171+
[cols="2"]
172+
|===
173+
| Send e-mail without attachment
174+
| `ses:SendEmail`
175+
176+
| Send e-mail with attachment
177+
| `ses:SendRawEmail`
178+
179+
|===
180+
181+
Sample IAM policy granting access to SES:
182+
183+
[source,json,indent=0]
184+
----
185+
{
186+
"Version": "2012-10-17",
187+
"Statement": [
188+
{
189+
"Effect": "Allow",
190+
"Action": [
191+
"ses:SendEmail",
192+
"ses:SendRawEmail"
193+
],
194+
"Resource": "arn:aws:ses:your:arn"
195+
}
196+
]
197+
}
198+
----

docs/src/main/asciidoc/spring-cloud-aws.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,8 +425,8 @@ The next example shows a typical Spring `@Configuration` class that enables the
425425
----
426426

427427
==== Enabling instance metadata support in Spring Boot
428-
The instance metadata is automatically available in a Spring Boot application as a property source if the application
429-
is running on an EC2 instance.
428+
The instance metadata is available in a Spring Boot application as a property source if the application
429+
is running on an EC2 instance and `cloud.aws.instance.data.enabled` property is set to `true`.
430430

431431
==== Using instance metadata
432432
Instance metadata can be used in XML, Java placeholders and expressions. The example below demonstrates the usage of

docs/src/main/asciidoc/sqs.adoc

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,3 +268,41 @@ public void receive(S3EventNotification s3EventNotificationRecord) {
268268
S3EventNotification.S3Entity s3Entity = s3EventNotificationRecord.getRecords().get(0).getS3();
269269
}
270270
----
271+
272+
=== IAM Permissions
273+
Following IAM permissions are required by Spring Cloud AWS:
274+
275+
[cols="2"]
276+
|===
277+
| Send message to Queue
278+
| `sqs:SendMessage`
279+
280+
| Receive message from queue
281+
| `sqs:ReceiveMessage`
282+
283+
| Delete message from queue
284+
| `sqs:DeleteMessage`
285+
286+
| To use sqsListener with SimpleMessageListenerContainerFactory you will need to add as well
287+
| `sqs:GetQueueAttributes`
288+
289+
|===
290+
291+
Sample IAM policy granting access to SQS:
292+
293+
[source,json,indent=0]
294+
----
295+
{
296+
"Version": "2012-10-17",
297+
"Statement": [
298+
{
299+
"Effect": "Allow",
300+
"Action": [
301+
"sqs:DeleteMessage",
302+
"sqs:ReceiveMessage",
303+
"sqs:SendMessage",
304+
"sqs:GetQueueAttributes"
305+
],
306+
"Resource": "yourARN"
307+
}
308+
----

pom.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,13 @@
6161
<module>spring-cloud-aws-autoconfigure</module>
6262
<module>spring-cloud-aws-parameter-store-config</module>
6363
<module>spring-cloud-aws-secrets-manager-config</module>
64+
<module>spring-cloud-aws-ses</module>
6465
<module>spring-cloud-starter-aws</module>
6566
<module>spring-cloud-starter-aws-jdbc</module>
6667
<module>spring-cloud-starter-aws-messaging</module>
6768
<module>spring-cloud-starter-aws-parameter-store-config</module>
6869
<module>spring-cloud-starter-aws-secrets-manager-config</module>
70+
<module>spring-cloud-starter-aws-ses</module>
6971
<module>spring-cloud-aws-integration-test</module>
7072
<module>docs</module>
7173
<module>samples</module>

spring-cloud-aws-autoconfigure/pom.xml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@
4848
<artifactId>spring-cloud-aws-parameter-store-config</artifactId>
4949
<optional>true</optional>
5050
</dependency>
51+
<dependency>
52+
<groupId>org.springframework.cloud</groupId>
53+
<artifactId>spring-cloud-aws-ses</artifactId>
54+
<optional>true</optional>
55+
</dependency>
5156
<dependency>
5257
<groupId>org.springframework.boot</groupId>
5358
<artifactId>spring-boot-autoconfigure</artifactId>
@@ -57,6 +62,25 @@
5762
<artifactId>spring-boot-actuator-autoconfigure</artifactId>
5863
<optional>true</optional>
5964
</dependency>
65+
66+
<dependency>
67+
<groupId>org.springframework.security</groupId>
68+
<artifactId>spring-security-config</artifactId>
69+
<optional>true</optional>
70+
</dependency>
71+
72+
<dependency>
73+
<groupId>org.springframework.security</groupId>
74+
<artifactId>spring-security-oauth2-jose</artifactId>
75+
<optional>true</optional>
76+
</dependency>
77+
78+
<dependency>
79+
<groupId>org.springframework.security</groupId>
80+
<artifactId>spring-security-oauth2-resource-server</artifactId>
81+
<optional>true</optional>
82+
</dependency>
83+
6084
<dependency>
6185
<groupId>io.micrometer</groupId>
6286
<artifactId>micrometer-registry-cloudwatch</artifactId>
@@ -87,6 +111,11 @@
87111
<artifactId>aws-java-sdk-ses</artifactId>
88112
<optional>true</optional>
89113
</dependency>
114+
<dependency>
115+
<groupId>com.amazonaws</groupId>
116+
<artifactId>aws-java-sdk-cloudformation</artifactId>
117+
<optional>true</optional>
118+
</dependency>
90119
<dependency>
91120
<groupId>com.amazonaws</groupId>
92121
<artifactId>aws-java-sdk-cloudwatch</artifactId>

spring-cloud-aws-autoconfigure/src/main/java/org/springframework/cloud/aws/autoconfigure/condition/ConditionalOnAwsCloudEnvironment.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
* started inside an AWS cloud environment. Useful for beans that should only be created
3030
* if the application context is bootstrapped inside the AWS environment.
3131
*
32+
* Note: if application does not run in AWS environment, evaluating this condition can
33+
* take several seconds.
34+
*
3235
* @author Agim Emruli
3336
* @author Eddú Meléndez
3437
*/

spring-cloud-aws-autoconfigure/src/main/java/org/springframework/cloud/aws/autoconfigure/context/ContextInstanceDataAutoConfiguration.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package org.springframework.cloud.aws.autoconfigure.context;
1818

1919
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
20+
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
2021
import org.springframework.cloud.aws.autoconfigure.condition.ConditionalOnAwsCloudEnvironment;
2122
import org.springframework.context.EnvironmentAware;
2223
import org.springframework.context.annotation.Configuration;
@@ -28,9 +29,13 @@
2829
import static org.springframework.cloud.aws.context.config.support.ContextConfigurationUtils.registerInstanceDataPropertySource;
2930

3031
/**
32+
* Enables passing EC2 instance metadata into Spring
33+
* {@link org.springframework.context.annotation.PropertySource}.
34+
*
3135
* @author Agim Emruli
3236
*/
3337
@Configuration(proxyBeanMethods = false)
38+
@ConditionalOnProperty(name = "cloud.aws.instance.data.enabled", havingValue = "true")
3439
@ConditionalOnAwsCloudEnvironment
3540
@Import(ContextInstanceDataAutoConfiguration.Registrar.class)
3641
public class ContextInstanceDataAutoConfiguration {

spring-cloud-aws-autoconfigure/src/main/java/org/springframework/cloud/aws/autoconfigure/jdbc/AmazonRdsDatabaseProperties.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public static class RdsInstance {
8282
private boolean readReplicaSupport = false;
8383

8484
public boolean hasRequiredPropertiesSet() {
85-
return !StringUtils.isEmpty(this.getDbInstanceIdentifier()) && !StringUtils.isEmpty(this.getPassword());
85+
return StringUtils.hasLength(this.getDbInstanceIdentifier()) && StringUtils.hasLength(this.getPassword());
8686
}
8787

8888
public String getDbInstanceIdentifier() {

0 commit comments

Comments
 (0)