Send Apple HLS content to Amazon S3 using Wowza Streaming Engine

Stream targets in Wowza Streaming Engine™ media server software allow you to send live streams to widely distributed destinations.

This article explains how to create a Fastly stream target with a push connection to distribute your live streams using Wowza CDN on Fastly. You need an Amazon AWS account and a Wowza Video account for this workflow.

Alternatively, you may configure your connection for a pull-based workflow where the destination pulls the stream data from the server. To help you determine which CDN workflow best fits your streaming needs, see Scaling Wowza Streaming Engine with Wowza CDN.

We typically recommend the built-in push-based CDN workflow that includes distribution with Wowza Video. This method was introduced with Wowza Streaming Engine 4.8.23. For earlier versions of Wowza Streaming Engine, we recommend the following options to achieve the same push-based functionality:

  • If running versions 4.8.18 to 4.8.22, you must download a separate plugin.
  • For versions before 4.8.18, set up an S3 bucket in AWS as an origin to distribute your live streams, as described in this article.

Additionally, if you have more complex streaming scenarios, you may want to consider the pull-based workflow instead. Examples that may be a better fit for the pull-based approach include streams with multiple language or video tracks, WebVTT captions, or redundant stream workflows.

Video tutorial: Send Apple HLS content to Amazon S3 using Wowza Streaming Engine with a push-based workflow


See how to configure your connection to Wowza CDN on Fastly for a push-based workflow.

Before you start


Before you start, you should have access to the following items:

  • A valid Wowza Streaming Engine license and a Wowza CDN subscription. Contact our sales team for more information.
  • An Amazon Web Service account with create, read, and write access to S3 storage using access key security credentials. See AWS Free Tier to create a free account.

1. Create a bucket in AWS S3

See Creating a bucket for instructions on how to create a bucket in AWS. You must configure some settings to allow streams to be played back from your S3 bucket. Configure the following:

  • ACLS must be enabled. For best results, the Object Ownership should be set to Object Writer.

Graphical user interface, application

Description automatically generated

  • Public Access must be enabled for objects in the bucket.

Graphical user interface, text, application

Description automatically generated
 

  • For testing direct playback from the bucket, you may need to enable Cross-origin resource sharing (CORS). After the bucket is created, select the Permissions tab for the bucket and add the following CORS configuration.
     
    Note: CORS is only required for direct playback from the bucket. It's not required for playback via the Fastly custom stream target.
[ 
    { 
        "AllowedHeaders": [], 
        "AllowedMethods": [ 
            "GET" 
        ], 
        "AllowedOrigins": [ 
            "*" 
        ], 
        "ExposeHeaders": [] 
    } 
] 

Once your bucket is created, you must record the following information from your Amazon account:

  • Bucket name: For example, my-s3-bucket.
  • Bucket Region: For example, us-west-1.
  • AWS Bucket URL: This will be used with the Fastly custom stream target. The format for the AWS BucketURL is https://[bucket-name].s3.[region].amazonaws.com/ . For example, https://my-s3-bucket.s3.us-west-1.amazonaws.com/.
     
    For buckets in the us-east-1 region, AWS doesn't require the region in the URL (https://[bucket-name].s3.amazonasw.com/). This is a legacy format AWS URL. It won't work with Fastly custom stream targets. Instead, you need to use the regionalised S3 URL for us-east-1, which is https://[bucket-name].s3.us-east-1.amazonaws.com

You also need to record your IAM credentials. These are set per user in AWS. See Create an IAM admin and user group in AWS for more information. Record the following:

  • Access ID: For example AKIAI6234VXXREN3KWJQ.
  • Secret Access Key: For example, y1PFFPOEwSrUfvvvdalA1qs9sFDM7+QzQTMHoqP7.

2. Enable the Wowza Streaming Engine stream target

Before you stream, you must enable the Stream Targets feature for the Wowza Streaming Engine application or the individual stream target you created.

In the sidebar navigation for your application, look for a checkmark next to Stream Targets. If you don't see the checkmark, click Stream Targets in the sidebar navigation, then click Enable Stream Targets.

When stream targets are enabled, a checkmark appears next to Stream Targets in the sidebar navigation. The Stream Targets page also shows the status as Enabled.

3. Create a stream target in Wowza Streaming Engine to send the stream to AWS S3

Once you have created your AWS S3 bucket and recorded your credentials, you should add a new map entry to the PushPublishMap.txt file. See About map entries for more information about map entries.

  1. Locate and edit the PushPublishMap.txt file. The default map file location is [install-dir]/conf/[application]/PushPublishMap.txt. The map file is automatically created for you in this location when you enable the stream targets feature.
  2. You need to add a new entry to the PushPublishMap.txt.
     
    Note: Each Entry in the map file must be on a single line.

You can use the following sample code, making sure to:

  • Set http.relativePlaylists to true. It is set to false by default.
  • Set the>stream_name[_xxx]to match the incoming stream name or transcoder rendition for each stream target.
  • Set entryName to a unique name for your stream target.
  • For adaptive bitrate entries, set profile to group-manager and group.name to a unique name for your stream target.
  • Set cloudstorage.bucketName to the Bucket Name provided by AWS in Step 1.
  • Set cloudstorage.region to the Bucket Region provided by AWS in Step 1.
  • Set cloudstorage.accessID to the Access ID provided by AWS in Step 1.
  • Set cloudstorage.secretAccessKey to the Secret Access Key provided by AWS in Step 1.
  • Change any additional values to be unique to your stream target.
  • Before saving the file, use a JSON validator, such as https://jsonlint.com, to validate the map entries. Copy the complete text after the = sign into the validator to check the syntax. 
Note: For more information on map entries, see Use CDNs and services to distribute live streams from Wowza Streaming Engine.

Sample code — Single bitrate map entries

stream_name={"entryName": "WSC_via_S3", "streamName": "stream_name", "profile": "cupertino-cloudstorage", "cloudstorage.provider": "S3", "cloudstorage.bucketName": "my-s3-bucket", "cloudstorage.region": "us-west-1", "cloudstorage.accessID": "AKIAI6IO5VXX-EXAMPLE", "cloudstorage.secretAccessKey": "y1PFFPOEwSrUfWyhalA1qs9sFDM7+QzQ-example", "debugLog": false, "cloudstorage.transportDebug": false, "http.relativePlaylists": true}

Sample code — Adaptive bitrate map entries

stream_name={"entryName":"WSC_via_S3", "profile":"group-manager", "group.name":"stream_name_ABR", "cloudstorage.transportDebug":"false", "cloudstorage.secretAccessKey":"y1PFFPOEwSrUfWyhalA1qs9sFDM7+QzQ-example", "http.relativePlaylists":"true", "cloudstorage.provider":"S3", "cloudstorage.region":"us-west-1", "cloudstorage.accessID":"AKIAI6IO5VXX-EXAMPLE", "cloudstorage.bucketName":"my-s3-bucket", "childProfile":"cupertino-cloudstorage", "group.streamMatcher":"namePrefix"}

  1. Sign in to Wowza Streaming Engine.
  2. Click Server on the menu bar, and then click Restart. Your new chunklist and playlist will be loaded into your S3 bucket. This may take up to a minute.
  3. Copy the URL for the playlist from your S3 bucket, for example, https://my-s3-bucket.s3-us-west-1.amazonaws.com/myStream/playlist.m3u8.
     
    Note: For buckets in the us-east-1 region, this URL will be the legacy format and needs to be changed to include the region. 
  4. Test the playback using the URL for your playlist in your player.
     
    Note: Some players will require CORS headers to be enabled for direct playback from the bucket.

4. Create a Fastly custom stream target in Wowza Video

Note: Only one Fastly custom stream target needs to be created for each S3 bucket.
  1. Sign in to Wowza Video.
  2. Click Advanced > Stream Targets in the sidebar navigation.
  3. On the Stream Targets page, click the Add Target button.
  4. Select Wowza CDN on Fastly, then click Add.
  5. On the Add a Wowza CDN on Fastly target setup page, enter a stream target name.
  6. Select the Enable a Custom Origin checkbox.
  7. Select your Custom Origin Region from the drop-down menu.
  8. Paste the AWS Bucket URL provided by AWS in Step 1 in the Custom Origin URL field, then click Add.
  9. Record your Custom Origin URL. For example: https://cdn3.wowza.com/5/QkxIcU9SMnh6d3JX/[application-name]/[stream-name].
     
  10. Test playback using your Custom Origin URL in your player.

    You can modify the root address of the playlist URL you copied from your S3 bucket in Step 3 with the Custom Origin URL excluding the [application-name]/[stream-name] to create a .m3u8 file for playback.

    Examples
     

    Custom Origin URL - https://cdn3.wowza.com/5/QkxIcU9S-example/[application-name]/[stream-name] 

    Single bitrate (uses streamName in the URL) 

    S3 URL -  https://my-s3-bucket.s3.us-west-1.amazonaws.com/myStream/playlist.m3u8 

    Wowza CDN URL - https://cdn3.wowza.com/5/QkxIcU9S-example/myStream/playlist.m3u8 

    Adaptive bitrate (uses groupName in the URL) 

    S3 URL - https://my-s3-bucket.s3.us-west-1.amazonaws.com/myStream-ABR/playlist.m3u8 

    Wowza CDN URL - https://cdn3.wowza.com/5/QkxIcU9S-example/myStream-ABR/playlist.m3u8

More resources