Spring Cloud for Amazon Web Services

Spring Cloud for Amazon Web Services, part of the Spring Cloud umbrella project, eases the integration with hosted Amazon Web Services. It offers a convenient way to interact with AWS provided services using well-known Spring idioms and APIs, such as the messaging or caching API. Developers can build their application around the hosted services without having to care about infrastructure or maintenance.

Quick Start
Fork me on GitHub

Features

  • Spring Messaging API implementation for SQS.
  • Spring Cache API implementation for ElastiCache.
  • Annotation-based mapping of SNS endpoints (HTTP).
  • Access the resources by their logical name defined in a CloudFormation stack.
  • Automatic JDBC DataSource creation based on the logical name of an RDS instance.
  • Ant-style path matching ResourceLoader for S3 buckets.

Annotation-based SQS Queue Listener

@MessageMapping("logicalQueueName")
private void receiveMessage(Person person, @Header("SenderId") String senderId) {
    // ...
}

Annotation-based SNS Listener

@Controller
@RequestMapping("/sns/receive")
public class SnsEndpointController {

@NotificationMessageMapping
public void receiveNotification(@NotificationMessage String message, @NotificationSubject String subject) {
    // ...
}

@NotificationSubscriptionMapping
public void confirmSubscription(NotificationStatus notificationStatus) {
    notificationStatus.confirmSubscription();
}

Messaging Templates

snsTemplate.sendNotification("SnsTopic", "message", "subject");
sqsTemplate.convertAndSend("Queue", new Person("John", "Doe"));

Quick Start

Download

The recommended way to get started using spring-cloud-aws in your project is with a dependency management system – the snippet below can be copied and pasted into your build. Need help? See our getting started guides on building with Maven and Gradle.

<!-- Define global credentials for all the AWS clients -->
<aws-context:context-credentials>
    <aws-context:instance-profile-credentials/>
    <aws-context:simple-credentials access-key="${accessKey:}"
                                    secret-key="${secretKey:}"/>
</aws-context:context-credentials>

<!-- Define global region -->
<aws-context:context-region region="EU_WEST_1"/>

<!-- Cloud Formation Stack -->
<aws-context:stack-configuration stack-name="StackName"/>