How to use where clause in Knex
Create refunds with Stripe
Load HTML with Cheerio
How to send POST request with Axios
Find intersection of array in Lodash
Powered by Official white Bloop logo with a period

Terms / Privacy / Search / Support

  • import * as api from '@aws-cdk/aws-apigateway';
    import * as lambda from '@aws-cdk/aws-lambda';
    
    const rule = new events.Rule(this, 'Rule', {
      schedule: events.Schedule.rate(cdk.Duration.minutes(1)),
    });
    
    const fn = new lambda.Function( this, 'MyFunc', {
      handler: 'index.handler',
      runtime: lambda.Runtime.NODEJS_12_X,
      code: lambda.Code.fromInline( 'exports.handler = e => {}' ),
    } );
    
    const restApi = new api.LambdaRestApi( this, 'MyRestAPI', { handler: fn } );
    
    const dlq = new sqs.Queue(this, 'DeadLetterQueue');
    
    rule.addTarget(
      new targets.ApiGateway( restApi, {
        path: '/*/test',
        method: 'GET',
        stage:  'prod',
        pathParameterValues: ['path-value'],
        headerParameters: {
          Header1: 'header1',
        },
        queryStringParameters: {
          QueryParam1: 'query-param-1',
        },
        deadLetterQueue: dlq
      } ),
    )
    
    Docs
  • import { Rule, Schedule } from '@aws-cdk/aws-events';
    import { EcsTask } from '@aws-cdk/aws-events-targets';
    import { Cluster, TaskDefinition } from '@aws-cdk/aws-ecs';
    import { Role } from '@aws-cdk/aws-iam';
    
    declare const cluster: Cluster;
    declare const taskDefinition: TaskDefinition;
    declare const role: Role;
    
    const ecsTaskTarget = new EcsTask({ cluster, taskDefinition, role });
    
    new Rule(this, 'ScheduleRule', {
     schedule: Schedule.cron({ minute: '0', hour: '4' }),
     targets: [ecsTaskTarget],
    });
    
    Docs
  • // The code below shows an example of how to instantiate this type.
    // The values are placeholders you should change.
    import * as assets from '@aws-cdk/assets';
    import * as iam from '@aws-cdk/aws-iam';
    import * as synthetics from '@aws-cdk/aws-synthetics';
    import * as cdk from '@aws-cdk/core';
    
    declare const dockerImage: cdk.DockerImage;
    declare const grantable: iam.IGrantable;
    declare const localBundling: cdk.ILocalBundling;
    const assetCode = new synthetics.AssetCode('assetPath', /* all optional props */ {
      assetHash: 'assetHash',
      assetHashType: cdk.AssetHashType.SOURCE,
      bundling: {
        image: dockerImage,
    
        // the properties below are optional
        command: ['command'],
        entrypoint: ['entrypoint'],
        environment: {
          environmentKey: 'environment',
        },
        local: localBundling,
        outputType: cdk.BundlingOutput.ARCHIVED,
        securityOpt: 'securityOpt',
        user: 'user',
        volumes: [{
          containerPath: 'containerPath',
          hostPath: 'hostPath',
    
          // the properties below are optional
          consistency: cdk.DockerVolumeConsistency.CONSISTENT,
        }],
        workingDirectory: 'workingDirectory',
      },
      exclude: ['exclude'],
      follow: assets.FollowMode.NEVER,
      followSymlinks: cdk.SymlinkFollowMode.NEVER,
      ignoreMode: cdk.IgnoreMode.GLOB,
      readers: [grantable],
      sourceHash: 'sourceHash',
    });
    
    Docs
  • // A pipeline being used as a target for a CloudWatch event rule.
    import * as targets from '@aws-cdk/aws-events-targets';
    import * as events from '@aws-cdk/aws-events';
    
    // kick off the pipeline every day
    const rule = new events.Rule(this, 'Daily', {
      schedule: events.Schedule.rate(Duration.days(1)),
    });
    
    declare const pipeline: codepipeline.Pipeline;
    rule.addTarget(new targets.CodePipeline(pipeline));
    
    Docs
  • import * as codepipeline from '@aws-cdk/aws-codepipeline';
    
    const pipeline = new codepipeline.Pipeline(this, 'Pipeline');
    
    const rule = new events.Rule(this, 'Rule', {
      schedule: events.Schedule.expression('rate(1 hour)'),
    });
    
    rule.addTarget(new targets.CodePipeline(pipeline));
    
    Docs
  • Powered by Official black Bloop logo with a period
    download the IDE extension

    View other examples