How to use the @pulumi/cloud-aws.Task function in @pulumi/cloud-aws

To help you get started, we’ve selected a few @pulumi/cloud-aws examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pulumi / examples / cloud-js-thumbnailer-machine-learning / index.js View on Github external
// Copyright 2016-2018, Pulumi Corporation.  All rights reserved.

"use strict";

const cloud = require("@pulumi/cloud-aws");
const video = require("./video-label-processor");

// A bucket to store videos and thumbnails.
const bucket = new cloud.Bucket("bucket");
const bucketName = bucket.bucket.id;

// A task which runs a containerized FFMPEG job to extract a thumbnail image.
const ffmpegThumbnailTask = new cloud.Task("ffmpegThumbTask", {
    build: "./docker-ffmpeg-thumb",
    memoryReservation: 512,
});

// Use module for processing video through Rekognition
const videoProcessor = new video.VideoLabelProcessor();

// When a new video is uploaded, start Rekognition label detection
bucket.onPut("onNewVideo", bucketArgs => {
    console.log(`*** New video: file ${bucketArgs.key} was uploaded at ${bucketArgs.eventTime}.`);
    videoProcessor.startRekognitionJob(bucketName.get(), bucketArgs.key);
    return Promise.resolve();
}, { keySuffix: ".mp4" });  // run this Lambda only on .mp4 files

// When Rekognition processing is complete, run the FFMPEG task on the video file
// Use the timestamp with the highest confidence for the label "cat"
github pulumi / examples / cloud-js-thumbnailer / index.js View on Github external
// Copyright 2016-2018, Pulumi Corporation.  All rights reserved.

const cloud = require("@pulumi/cloud-aws");

// A bucket to store videos and thumbnails.
const bucket = new cloud.Bucket("bucket");
const bucketName = bucket.bucket.id;

// A task which runs a containerized FFMPEG job to extract a thumbnail image.
const ffmpegThumbnailTask = new cloud.Task("ffmpegThumbTask", {
    build: "./docker-ffmpeg-thumb",
    memoryReservation: 512,
});

// When a new video is uploaded, run the FFMPEG task on the video file.
// Use the time index specified in the filename (e.g. cat_00-01.mp4 uses timestamp 00:01)
bucket.onPut("onNewVideo", bucketArgs => {
    console.log(`*** New video: file ${bucketArgs.key} was uploaded at ${bucketArgs.eventTime}.`);
    const file = bucketArgs.key;
    
    const thumbnailFile = file.substring(0, file.indexOf('_')) + '.jpg';
    const framePos = file.substring(file.indexOf('_')+1, file.indexOf('.')).replace('-',':');

    ffmpegThumbnailTask.run({
        environment: {
            "S3_BUCKET":   bucketName.get(),

@pulumi/cloud-aws

An implementation of the Pulumi Framework for targeting Amazon Web Services (AWS).

Apache-2.0
Latest version published 9 months ago

Package Health Score

66 / 100
Full package analysis