Integrating Play application with Amazon S3

For this recipe, we will explore how Play applications can upload files directly to Amazon Web Services (AWS) S3, a popular cloud storage solution.

For more information about S3, please refer to

How to do it…

For Java, we need to take the following steps:

  1. Run the foo_java application with Hot-Reloading enabled:
        activator "~run"
  2. Declare play-s3 as a project dependency in build.sbt:
        "com.amazonaws" % "aws-java-sdk" % "1.3.11"
  3. Specify your AWS credentials in foo_java/conf/application.conf:
        aws.accessKeyId="YOUR S3 ACCESS KEY"
        aws.secretKey="YOUR S3 SECRET KEY"
        fooscala.s3.bucketName="YOUR S3 BUCKET NAME"
  4. Modify foo_java/app/controllers/ by adding the following code: ...

Get Play Framework Cookbook - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.