Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jeavon Leopold 3072 posts 13628 karma points MVP 10x admin c-trib
    Mar 22, 2011 @ 11:30
    Jeavon Leopold
    1

    Amazon S3 Permissions for Cloudfront

    Firstly, just wanted to feedback that this package is absolutely amazing!  We have been using the Amazon provider and it works beautifully.

    However, we encountered problem and thought it would be worth sharing in case anyone else has the same issue.

    The problem was that the Universal Media picker could upload to Amazon S3 no problem, but the permissions on the uploaded files in S3 prevented the content from being publically viewable so the files would not show on the website using Cloudfront. 

    After some digging around in Amazon documentation we found that we needed a “Bucket Policy”, so the solution was to edit “Bucket Policy” on the bucket used by Cloudfront and use the following snippet (replacing {bucketName} with your own bucket name):

     

    {

    "Version": "2008-10-17",

    "Id": "271e7e33-e39f-474f-a554-6517c9565038",

    "Statement": [

    {

    "Sid": "AllowPublicRead",

    "Effect": "Allow",

    "Principal": {

    "AWS": "*"

    },

    "Action": "s3:GetObject",

    "Resource": "arn:aws:s3:::{bucketName}/*"

    }

    ]

    }

     

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Mar 22, 2011 @ 11:39
    Matt Brailsford
    0

    Hi Jeavon.

    Thanks for sharing, I'm sure this could come in really usefull for others implementing the Amazon provider.

    All the best

    Matt

  • Morten Christensen 596 posts 2773 karma points admin hq c-trib
    Mar 22, 2011 @ 11:46
    Morten Christensen
    0

    Hi Jeavon,

    Thanks for sharing.

    I'm planning updates to some of the providers this week, and the thing with public files is one of the changes as its been reported by others as well. Don't know how have missed it before :-S

    If time allows it I will also try and add folder support, so its a little more like the AWS Console.

    - Morten

  • Jeavon Leopold 3072 posts 13628 karma points MVP 10x admin c-trib
    Mar 22, 2011 @ 12:23
    Jeavon Leopold
    0

    Hi Matt & Morten,

    The only other thing that might be incorporated into a provider update (although I'm not sure how) was that we have two Cloudfront distributions on the same S3 bucket, one for standard download and one for RTMP streaming. We added a additional subdomain rtmp in front of the standard distribution CNAME and did some simple XLST string manipulation to get the correct URL for RTMP but it might be useful if it was possible to set an optional streamer CNAME in the data type so it can easily be output.

    This is the type of logic we used:

    <xsl:variable name="movieURL" select="$currentPage/*[name()=$properyNameMacro]/value"/>

    standard download file: http://<xsl:value-of select="$movieURL"/>

    streamer: rtmp://rtmp.<xsl:value-of select="substring-before($movieURL,'/')"/>/cfx/st

    file for streamer: <xsl:value-of select="substring-after($movieURL,'/')"/>

    We use JWPlayer which in it's newest version 5.5 natively supports Flash RTMP to HTML5 Download failover, so the best of all worlds in standard browsers and iOS devices when showing video from Amazon Cloudfront.

    LongTail have a good list of CDN's and their different streamer URL's at http://www.longtailvideo.com/support/jw-player/jw-player-for-flash-v5/17674/configuring-the-jw-player-for-your-cdn

    Jeavon

  • Morten Christensen 596 posts 2773 karma points admin hq c-trib
    Mar 23, 2011 @ 18:26
    Morten Christensen
    0

    Hi Jeavon,

    I'm not sure if I understand your request correct, but couldn't you achieve this by simply creating two datatypes, which both use the S3 provider but are configured to use a CNAME each - one for streaming and one for files. I imagine that you probably don't use the same property for serving up files and streaming content, but please correct me if im wrong.

    So you use one property for files and another property for streaming - each with a S3 Provider as DataType.

    - Morten

  • Jeavon Leopold 3072 posts 13628 karma points MVP 10x admin c-trib
    Mar 24, 2011 @ 12:20
    Jeavon Leopold
    0

    Hi Morten,

    Yes, we could use 2 Datatypes but that would mean the user would have to select the same file for both (not the end of the world). However with Amazon streaming the required output URL is also slightly different as it has the /cfx/st between the CNAME and the filename e.g. rtmp.cdn.yourdomain.tv/cfx/st/Video.mp4

    In an ideal world, there might an option in the data type settings called something like "Addtional CNAME for Streaming", which allows the entry of the optional, secondary streaming distribution, then it would be possible to access XML like this? (you want that in the current provider for a steaming distribution anyway?)

    <productMovie>
    <value dataTypeId="1370">cdn.yourdomain.tv/Video.mp4</value>
    <streamerUrl dataTypeId="1370">rtmp.cdn.yourdomain.tv/cfx/st</streamerUrl>
    <mediaFileName dataTypeId="1370">Video.mp4</mediaFileName>
    </productMovie>

    Maybe this is not possible within the UMP?

    What this allows using JWPlayer for example is for it to use the RTMP steaming media for Flash capable browsers and HTML5 download for iOS devices.

    Below is an example of how this data would be used with JWPlayer 5.5:

    <script type="text/javascript">
      jwplayer('mediaplayer').setup({
        'id': 'playerID',
        'width': '480',
        'height': '270',
        'provider': 'rtmp',
        'streamer': 'rtmp://rtmp.cdn.yourdomain.tv/cfx/st',
        'file': 'Video.mp4',
        'image': 'video.jpg',
        'modes': [
            {type: 'flash', src: 'player.swf'},
            {
              type: 'html5',
              config: {
               'file': 'http://cdn.yourdomain.tv/Video.mp4',
               'provider': 'video'
              }
            },
            {
              type: 'download',
              config: {
               'file': 'http://cdn.yourdomain.tv/Video.mp4',
               'provider': 'video'
              }
            }
        ]
      });
    </script>

    Regards,

    Jeavon

Please Sign in or register to post replies

Write your reply to:

Draft