index.adoc 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. [[introduction]]
  2. = Spring Cloud AWS
  3. include::intro.adoc[]
  4. include::contributing.adoc[]
  5. == Using Amazon Web Services
  6. AWS provides a https://aws.amazon.com/sdk-for-java/[Java SDK] to issue requests for the all services provided by the
  7. https://aws.amazon.com[Amazon Web Service] platform. While the SDK offers all functionality available on AWS, there is a considerable amount of low level code needed to use it in Spring idiomatic way.
  8. Spring Cloud AWS provides application developers already integrated Spring-based modules to consume the most popular AWS services and avoid low level code as much as possible.
  9. Thanks to Spring Cloud AWS modularity you can include only dependencies relevant to the particular AWS service you want to integrate with.
  10. It also simplifies creating any non-integrated AWS SDK client by auto-configuring region and credentials providers.
  11. That being said, it is perfectly valid option to use AWS SDK without using Spring Cloud AWS.
  12. [TIP]
  13. ====
  14. Note, that Spring provides support for other AWS services in following projects:
  15. * https://github.com/spring-cloud/spring-cloud-stream-binder-aws-kinesis[Spring Cloud Stream Binder AWS Kinesis]
  16. * https://github.com/spring-cloud/spring-cloud-config[Spring Cloud Config Server] supports AWS Parameter Store and Secrets Manager
  17. * https://github.com/spring-projects/spring-integration-aws[Spring Integration for AWS]
  18. ====
  19. == Getting Started
  20. This section describes how to get up to speed with Spring Cloud AWS libraries.
  21. [[bill-of-materials]]
  22. === Bill of Materials
  23. The Spring Cloud AWS Bill of Materials (BOM) declares the recommended versions of all the dependencies used by a given release of Spring Cloud AWS. Using the BOM from your application's build script avoids the need for you to specify and maintain the dependency versions yourself. Instead, the version of the BOM you’re using determines the utilised dependency versions. It also ensures that you're using supported and tested versions of the dependencies by default, unless you choose to override them.
  24. If you’re a Maven user, you can use the BOM by adding the following to your `pom.xml` file -
  25. [source,xml,indent=0]
  26. ----
  27. <dependencyManagement>
  28. <dependencies>
  29. <dependency>
  30. <groupId>io.awspring.cloud</groupId>
  31. <artifactId>spring-cloud-aws-dependencies</artifactId>
  32. <version>{project-version}</version>
  33. <type>pom</type>
  34. <scope>import</scope>
  35. </dependency>
  36. </dependencies>
  37. </dependencyManagement>
  38. ----
  39. Gradle users can also use the Spring Cloud AWS BOM by leveraging Gradle (5.0+) native support for declaring dependency constraints using a Maven BOM. This is implemented by adding a 'platform' dependency handler method to the dependencies section of your Gradle build script. As shown in the snippet below this can then be followed by version-less declarations of the <<starter-dependencies>> for the one or more framework modules you wish to use, e.g. SQS.
  40. [source,groovy,indent=0,options="nowrap"]
  41. ----
  42. dependencies {
  43. implementation platform("io.awspring.cloud:spring-cloud-aws-dependencies:${springCloudAwsVersion}")
  44. // Replace the following with the starter dependencies of specific modules you wish to use
  45. implementation 'io.awspring.cloud:spring-cloud-aws-starter-sqs'
  46. }
  47. ----
  48. === Starter Dependencies
  49. Spring Cloud AWS offers https://github.com/awspring/spring-cloud-aws/tree/main/spring-cloud-aws-starters[starter dependencies] through Maven to easily depend on different modules of the library.
  50. Each starter contains all the dependencies and transitive dependencies needed to begin using their corresponding Spring Cloud AWS module.
  51. For example, if you wish to write a Spring application with S3, you would include the `spring-cloud-aws-starter-s3` dependency in your project.
  52. You do *not* need to include the underlying `spring-cloud-aws-s3` dependency, because the `starter` dependency includes it.
  53. A summary of these artifacts are provided below.
  54. |===
  55. | Spring Cloud AWS Starter | Description | Maven Artifact Name
  56. | Core
  57. | Automatically configure authentication and region selection
  58. | io.awspring.cloud:spring-cloud-aws-starter
  59. | DynamoDB
  60. | Provides integrations with DynamoDB
  61. | io.awspring.cloud:spring-cloud-aws-starter-dynamodb
  62. | S3
  63. | Provides integrations with S3
  64. | io.awspring.cloud:spring-cloud-aws-starter-s3
  65. | SES
  66. | Provides integrations with SES
  67. | io.awspring.cloud:spring-cloud-aws-starter-ses
  68. | SNS
  69. | Provides integrations with SNS
  70. | io.awspring.cloud:spring-cloud-aws-starter-sns
  71. | SQS
  72. | Provides integrations with SQS
  73. | io.awspring.cloud:spring-cloud-aws-starter-sqs
  74. | Parameter Store
  75. | Provides integrations with AWS Parameter Store
  76. | io.awspring.cloud:spring-cloud-aws-starter-parameter-store
  77. | Secrets Manager
  78. | Provides integrations with AWS Secrets manager
  79. | io.awspring.cloud:spring-cloud-aws-starter-secrets-manager
  80. |===
  81. === Choosing AWS SDK version
  82. The AWS SDK is released more frequently than Spring Cloud AWS. If you need to use a newer version of the SDK than
  83. the one configured by Spring Cloud AWS, add the SDK BOM to the dependency management section making sure it is declared
  84. before any other BOM dependency that configures AWS SDK dependencies.
  85. [source,xml,indent=0]
  86. ----
  87. <dependencyManagement>
  88. <dependencies>
  89. <dependency>
  90. <groupId>software.amazon.awssdk</groupId>
  91. <artifactId>bom</artifactId>
  92. <version>${aws-java-sdk.version}</version>
  93. <type>pom</type>
  94. <scope>import</scope>
  95. </dependency>
  96. </dependencies>
  97. </dependencyManagement>
  98. ----