O'Reilly logo

Play Framework Cookbook - Second Edition by Giancarlo Inductivo, Alexander Reelsen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 http://aws.amazon.com/s3/.

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/Application.java by adding the following code: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required