Skip to content

Latest commit

 

History

History

cloud-js-thumbnailer

Deploy

Video Thumbnailer

A video thumbnail extractor using serverless functions and containers.

Loosely derived from the example at https://serverless.com/blog/serverless-application-for-long-running-process-fargate-lambda/.

When a new video is uploaded, extract a thumbnail

Prerequisites

To run this example, make sure Docker is installed and running.

Running the App

Note: some values in this example will be different from run to run. These values are indicated with ***.

  1. Create a new stack:

    $ pulumi stack init thumbnailer-testing
    
  2. Configure Pulumi to use AWS Fargate, which is currently only available in us-east-1, us-east-2, us-west-2, and eu-west-1:

    $ pulumi config set aws:region us-west-2
    $ pulumi config set cloud-aws:useFargate true
    
  3. Restore NPM modules via npm install or yarn install.

  4. Preview and deploy the app via pulumi up. The preview will take some time, as it builds a Docker container. A total of 32 resources are created.

    $ pulumi up
    Previewing update of stack 'thumbnailer-testing'
    Previewing changes:
    
        Type                                Name                                   Plan          Info
    *   global                              global                                 no change     1 info message. info: Building container image 'pulum-
    +   pulumi:pulumi:Stack                       video-thumbnailer-thumbnailer-testing  create...     1 info message. info: Successfully tagged pulum-
    ...
    
    Do you want to perform this update? yes
    Updating stack 'thumbnailer-testing'
    Performing changes:
    
        Type                                Name                                   Status        Info
    *   global                              global                                 unchanged     1 info message. info: Building container image 'pulum-
    +   pulumi:pulumi:Stack                 video-thumbnailer-thumbnailer-testing  created      1 info message. info: 081c66fa4b0c: Pushed
    +   ├─ cloud:bucket:Bucket              bucket                                 created
    +   │  ├─ cloud:function:Function             onNewVideo                             created
    +   │  │  └─ aws:serverless:Function          onNewVideo                             created
    +   │  │  └─ aws:serverless:Function          onNewVideo                             created
    +   │  │  └─ aws:serverless:Function          onNewVideo                             created
    +   │  │  └─ aws:serverless:Function          onNewVideo                             created
    +   │  ├─ cloud:function:Function             onNewThumbnail                         created
    +   │  │  └─ aws:serverless:Function          onNewThumbnail                         created
    +   │  │  └─ aws:serverless:Function          onNewThumbnail                         created
    +   │  │     └─ aws:lambda:Function           onNewVideo                             created
    +   │  │  └─ aws:serverless:Function          onNewThumbnail                         created
    +   │  │  └─ aws:serverless:Function          onNewThumbnail                         created
    +   │  │     └─ aws:lambda:Function           onNewThumbnail                         created
    +   │  ├─ aws:s3:Bucket                       bucket                                 created
    +   │  ├─ aws:lambda:Permission               onNewThumbnail                         created
    +   │  ├─ aws:lambda:Permission               onNewVideo                             created
    +   │  └─ aws:s3:BucketNotification           bucket                                 created
    +   ├─ awsx:network:Network              default-vpc                            created
    +   ├─ aws:ecr:Repository                     pulum-dc8d99de-container               created
    +   ├─ cloud:global:infrastructure            global-infrastructure                  created
    +   │  ├─ aws:iam:Role                        pulumi-thumbnailer--task               created
    +   │  ├─ aws:iam:Role                        pulumi-thumbna-execution               created
    +   │  ├─ aws:iam:RolePolicyAttachment        pulumi-thu-task-32be53a2               created
    +   │  ├─ aws:iam:RolePolicyAttachment        pulumi-thu-task-fd1a00e5               created
    +   │  └─ aws:iam:RolePolicyAttachment        pulumi-thumbna-execution               created
    +   ├─ cloud:task:Task                        ffmpegThumbTask                        created
    +   │  ├─ aws:cloudwatch