2

For the project im working on, i need to consume videos on Android from AWS S3.

Im using private file access with signed urls. Everything works fine but the videos stream init time is quite long ( maybe 6-10 seconds).

Im trying to incorporate CloudFront to help serve the content more quickly. I've already created my 'Distribution' on the AWS console and set the proper fields to private content, etc..

Im stuck at generating the proper url so that the files are consumed from CloudFront and not S3.

I dont seem to find ANY documentation on CloudFront + Android nor any gradle dependency.

The online resources ive found point to Java tuts that rely on the CloudFrontUrlSigner class ( which is only included on the Java SDK , not the Android SDK )

So i tried using compile 'com.amazonaws:aws-java-sdk-cloudfront:1.10.+' on my app.gradle file and i can 'complete' the guide, but i get build-time errors.

How can i accomplish this?

Thanks, David.

David Azar
  • 371
  • 3
  • 13

1 Answers1

4

If you plan to access private content via CloudFront on Android, it will be a little tricky. You need to sign urls with a private key. See http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-trusted-signers.html. However, this is usually considered a risk on mobile platform as you need to deploy the key to your app. It's the main reason that CloudFrontUrlSigner is unavailable to the AWS Android SDK. I suggest to create your own backend which can vend a CloudFront url and send to your app. Here is the code that signs urls https://github.com/aws/aws-sdk-java/blob/master/aws-java-sdk-cloudfront/src/main/java/com/amazonaws/services/cloudfront/CloudFrontUrlSigner.java.

Yangfan
  • 1,866
  • 1
  • 11
  • 13
  • Yeah, that makes perfect sense. My backed is deployed in Lambda (written in Node.js) so im gonna follow this: http://stackoverflow.com/questions/21521302/creating-signed-s3-and-cloudfront-urls-via-the-aws-sdk. Thanks for getting back to me, Yangfan – David Azar Aug 14 '15 at 14:57