Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

awscdk-construct-fetch-job

Package Overview
Dependencies
Maintainers
0
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

awscdk-construct-fetch-job

AWS CDK Construct for scheduling a cron job that periodically accesses a MediaTailor endpoint

  • 0.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

awscdk-construct-fetch-job

View on Construct Hub

CDK Construct for scheduling a cron job that periodically accesses a MediaTialor endpoint

  • Input:

    • MediaTailor session initialization URL
    • Cron schedule expression
    • Fetch interval (seconds)
    • Fetch count per cron job
    • Email address for nortifying errors
  • Output:

    • Lambda function for fetching MediaTailor HLS/DASH endpoint
    • StepFunctions state-machine for invoking the Lambda function with a specified interval/count
    • EventBridge rule for periodically running the state-machine
    • SNS Topic for notifiying any errors

    Architecture Diagram

Install

NPM

Usage

Below is an example of deploying a cron job that runs at 11:59 every Saturday. Once the job gets started, it fetches the manifest every 2 seconds until it's repeated 30 times.

import { Stack, StackProps, CfnOutput } from 'aws-cdk-lib';
import { Construct } from 'constructs';
import { FetchJob } from 'awscdk-construct-fetch-job';

export class ExampleStack extends Stack {
  constructor(scope: Construct, id: string, props?: StackProps) {
    super(scope, id, props);

    const job = new FetchJob(this, 'FetchSchedule', {
      emailAddr: 'Your email address',
      sessionInitializationUrl: 'MediaTailor session initialization URL',
      startTime: { hour: '11', minute: '59', weekDay: 'SAT' }, // Cron pattern
      intervalInSeconds: 2, // Fetch interval
      fetchCount: 30, // Fetch count per cron job
    });

    // Print the ARN of the EventBridge rule
    new CfnOutput(this, "EventBridgeRuleARN", {
      value: job.rule.ruleArn,
      exportName: "EventBridgeRuleARN",
      description: "ARN of EventBridge Rule - fetch",
    });
  }
}

Keywords

FAQs

Package last updated on 01 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc