Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
  • Labs icon Lab
  • A Cloud Guru
Google Cloud Platform icon
Labs

Transcoding Video with S3 and Elastic Transcoder

In this hands-on AWS lab, we'll learn how to convert video files to different formats using Lambda, S3, and Amazon Elastic Transcoder. Elastic Transcoder is a media service designed to be a highly scalable, easy-to-use, and cost-effective way to convert (or "transcode") media files from their source format into versions that will play back on devices like smartphones, tablets, and PCs. In this lab, you will upload 4K Ultra HD sample videos to an S3 bucket and configure an Elastic Transcoder pipeline to automatically convert them to different formats. We'll set all this up with our own custom Lambda function — written in Python — using the Boto3 SDK. - Download the sample 4K videos [here](https://raw.githubusercontent.com/linuxacademy/content-lambda-boto3/master/Video-Transcoding/Aerial.mp4) and [here](https://raw.githubusercontent.com/linuxacademy/content-lambda-boto3/master/Video-Transcoding/Clouds.mp4). - Download the Lambda execution role IAM policy [here](https://raw.githubusercontent.com/linuxacademy/content-lambda-boto3/master/Video-Transcoding/lambda_execution_role.json). - Download the Lambda function source code [here](https://raw.githubusercontent.com/linuxacademy/content-lambda-boto3/master/Video-Transcoding/lambda_handler.py).

Google Cloud Platform icon
Labs

Path Info

Level
Clock icon Intermediate
Duration
Clock icon 1h 0m
Published
Clock icon Apr 05, 2019

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    Subscribe to an SNS topic.

    1. In the AWS Management Console, navigate to the SNS service.
    2. Select the Transcode topic.
    3. Under Actions, select Subscribe to topic
    4. In the Protocol dropdown box, select Email.
    5. In the Endpoint box, type an email address you can use to receive the notification.
    6. Click Create subscription.
    7. Go to your email application, and open the message from AWS Notifications.
    8. Click the link to confirm your subscription.
  2. Challenge

    Create Elastic Transcoder pipeline.

    1. In the AWS Management Console, navigate to Elastic Transcoder.
    2. Under Pipelines, select Create New Pipeline.
    3. Pipeline Name: Enter any name you like.
    4. Input Bucket: Select the existing bucket with source in the name.
    5. Allow the IAM role to be created automatically.
    6. For transcoded files, select the existing bucket with transcoded in the name.
    7. Storage Class: Choose either Standard or Reduced Redundancy.
    8. For thumbnails, select the existing bucket with thumbnails in the name.
    9. Storage Class: Choose either Standard or Reduced Redundancy.
    10. Note the Pipeline ID. This is available under pipeline details and is a different value than the pipeline name.
  3. Challenge

    Create Lambda function.

    1. In the AWS Management Console, navigate to AWS Lambda.
    2. Select Create Function.
    3. Give the function any name you like.
    4. For runtime, choose Python 3.7.
    5. Create a custom role, using the IAM policy here.
    6. Select Create Function.
    7. Select S3 as the trigger, and choose the bucket with source in the name.
    8. Select All object create events.
    9. Click Add.
    10. Click the function name at the top of the page to enable the function editor.
    11. Paste in the function body using the source code here.
    12. Set an environment variable called PIPELINE_ID and set its value to the pipeline ID from the previous task.
    13. Save the Lambda function.
  4. Challenge

    Upload video for transcoding.

    1. Download the sample 4K videos here and here.
    2. Navigate to the S3 bucket with source in its name.
    3. Upload one of the 4K video files.
    4. Observe in CloudWatch Logs and in your email inbox that the transcoding job completed successfully.
    5. Navigate to the S3 bucket with transcoded in its name.
    6. Verify that 1080p and 720p versions of your uploaded video are present.

The Cloud Content team comprises subject matter experts hyper focused on services offered by the leading cloud vendors (AWS, GCP, and Azure), as well as cloud-related technologies such as Linux and DevOps. The team is thrilled to share their knowledge to help you build modern tech solutions from the ground up, secure and optimize your environments, and so much more!

What's a lab?

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.

Start learning by doing today

View Plans