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

  • declare const fn: lambda.Function;
    const submitJob = new tasks.LambdaInvoke(this, 'Invoke Handler', {
      lambdaFunction: fn,
      payload: sfn.TaskInput.fromJsonPathAt('$.input'),
      invocationType: tasks.LambdaInvocationType.EVENT,
    });
    
    Docs
    0
  • new tasks.EmrCreateCluster(this, 'Create Cluster', {
      instances: {},
      name: sfn.TaskInput.fromJsonPathAt('$.ClusterName').value,
      stepConcurrencyLevel: 10,
    });
    
    Docs
    0
  • declare const fn: lambda.Function;
    new tasks.LambdaInvoke(this, 'Invoke with empty object as payload', {
      lambdaFunction: fn,
      payload: sfn.TaskInput.fromObject({}),
    });
    
    // use the output of fn as input
    new tasks.LambdaInvoke(this, 'Invoke with payload field in the state input', {
      lambdaFunction: fn,
      payload: sfn.TaskInput.fromJsonPathAt('$.Payload'),
    });
    
    Docs
    0
  • const queue = new sqs.Queue(this, 'Queue');
    
    // Use a field from the execution data as message.
    const task1 = new tasks.SqsSendMessage(this, 'Send1', {
      queue,
      messageBody: sfn.TaskInput.fromJsonPathAt('$.message'),
    });
    
    // Combine a field from the execution data with
    // a literal object.
    const task2 = new tasks.SqsSendMessage(this, 'Send2', {
      queue,
      messageBody: sfn.TaskInput.fromObject({
        field1: 'somedata',
        field2: sfn.JsonPath.stringAt('$.field2'),
      }),
    });
    
    Docs
    0
  • const clusterRole = new iam.Role(this, 'ClusterRole', {
      assumedBy: new iam.ServicePrincipal('ec2.amazonaws.com'),
    });
    
    const serviceRole = new iam.Role(this, 'ServiceRole', {
      assumedBy: new iam.ServicePrincipal('elasticmapreduce.amazonaws.com'),
    });
    
    const autoScalingRole = new iam.Role(this, 'AutoScalingRole', {
      assumedBy: new iam.ServicePrincipal('elasticmapreduce.amazonaws.com'),
    });
    
    autoScalingRole.assumeRolePolicy?.addStatements(
      new iam.PolicyStatement({
        effect: iam.Effect.ALLOW,
        principals: [
          new iam.ServicePrincipal('application-autoscaling.amazonaws.com'),
        ],
        actions: [
          'sts:AssumeRole',
        ],
      }));
    )
    
    new tasks.EmrCreateCluster(this, 'Create Cluster', {
      instances: {},
      clusterRole,
      name: sfn.TaskInput.fromJsonPathAt('$.ClusterName').value,
      serviceRole,
      autoScalingRole,
    });
    
    Docs
    0
  • new tasks.GlueStartJobRun(this, 'Task', {
      glueJobName: 'my-glue-job',
      arguments: sfn.TaskInput.fromObject({
        key: 'value',
      }),
      timeout: Duration.minutes(30),
      notifyDelayAfter: Duration.minutes(5),
    });
    
    Docs
    0
  • declare const fn: lambda.Function;
    new tasks.LambdaInvoke(this, 'Invoke with callback', {
      lambdaFunction: fn,
      integrationPattern: sfn.IntegrationPattern.WAIT_FOR_TASK_TOKEN,
      payload: sfn.TaskInput.fromObject({
        token: sfn.JsonPath.taskToken,
        input: sfn.JsonPath.stringAt('$.someField'),
      }),
    });
    
    Docs
    0
  • declare const fn: lambda.Function;
    new tasks.LambdaInvoke(this, 'Invoke with empty object as payload', {
      lambdaFunction: fn,
      payload: sfn.TaskInput.fromObject({}),
    });
    
    // use the output of fn as input
    new tasks.LambdaInvoke(this, 'Invoke with payload field in the state input', {
      lambdaFunction: fn,
      payload: sfn.TaskInput.fromJsonPathAt('$.Payload'),
    });
    
    Docs
    0
  • import * as events from '@aws-cdk/aws-events';
    
    const myEventBus = new events.EventBus(this, 'EventBus', {
      eventBusName: 'MyEventBus1',
    });
    
    new tasks.EventBridgePutEvents(this, 'Send an event to EventBridge', {
      entries: [{
        detail: sfn.TaskInput.fromObject({
          Message: 'Hello from Step Functions!',
        }),
        eventBus: myEventBus,
        detailType: 'MessageFromStepFunctions',
        source: 'step.functions',
      }],
    });
    
    Docs
    0
  • const queue = new sqs.Queue(this, 'Queue');
    
    // Use a field from the execution data as message.
    const task1 = new tasks.SqsSendMessage(this, 'Send1', {
      queue,
      messageBody: sfn.TaskInput.fromJsonPathAt('$.message'),
    });
    
    // Combine a field from the execution data with
    // a literal object.
    const task2 = new tasks.SqsSendMessage(this, 'Send2', {
      queue,
      messageBody: sfn.TaskInput.fromObject({
        field1: 'somedata',
        field2: sfn.JsonPath.stringAt('$.field2'),
      }),
    });
    
    Docs
    0
  • const topic = new sns.Topic(this, 'Topic');
    
    // Use a field from the execution data as message.
    const task1 = new tasks.SnsPublish(this, 'Publish1', {
      topic,
      integrationPattern: sfn.IntegrationPattern.REQUEST_RESPONSE,
      message: sfn.TaskInput.fromDataAt('$.state.message'),
      messageAttributes: {
        place: {
          value: sfn.JsonPath.stringAt('$.place'),
        },
        pic: {
          // BINARY must be explicitly set
          dataType: tasks.MessageAttributeDataType.BINARY,
          value: sfn.JsonPath.stringAt('$.pic'),
        },
        people: {
          value: 4,
        },
        handles: {
          value: ['@kslater', '@jjf', null, '@mfanning'],
        },
      },
    });
    
    // Combine a field from the execution data with
    // a literal object.
    const task2 = new tasks.SnsPublish(this, 'Publish2', {
      topic,
      message: sfn.TaskInput.fromObject({
        field1: 'somedata',
        field2: sfn.JsonPath.stringAt('$.field2'),
      }),
    });
    
    Docs
    0
  • new tasks.SageMakerCreateTrainingJob(this, 'TrainSagemaker', {
      trainingJobName: sfn.JsonPath.stringAt('$.JobName'),
      algorithmSpecification: {
        algorithmName: 'BlazingText',
        trainingInputMode: tasks.InputMode.FILE,
      },
      inputDataConfig: [{
        channelName: 'train',
        dataSource: {
          s3DataSource: {
            s3DataType: tasks.S3DataType.S3_PREFIX,
            s3Location: tasks.S3Location.fromJsonExpression('$.S3Bucket'),
          },
        },
      }],
      outputDataConfig: {
        s3OutputLocation: tasks.S3Location.fromBucket(s3.Bucket.fromBucketName(this, 'Bucket', 'mybucket'), 'myoutputpath'),
      },
      resourceConfig: {
        instanceCount: 1,
        instanceType: new ec2.InstanceType(sfn.JsonPath.stringAt('$.InstanceType')),
        volumeSize: Size.gibibytes(50),
      }, // optional: default is 1 instance of EC2 `M4.XLarge` with `10GB` volume
      stoppingCondition: {
        maxRuntime: Duration.hours(2),
      }, // optional: default is 1 hour
    });
    
    Docs
    0
  • // The code below shows an example of how to instantiate this type.
    // The values are placeholders you should change.
    import * as lambda from '@aws-cdk/aws-lambda';
    import * as stepfunctions from '@aws-cdk/aws-stepfunctions';
    import * as stepfunctions_tasks from '@aws-cdk/aws-stepfunctions-tasks';
    
    declare const function_: lambda.Function;
    declare const taskInput: stepfunctions.TaskInput;
    
    const runLambdaTask = new stepfunctions_tasks.RunLambdaTask(function_, /* all optional props */ {
      clientContext: 'clientContext',
      integrationPattern: stepfunctions.ServiceIntegrationPattern.FIRE_AND_FORGET,
      invocationType: stepfunctions_tasks.InvocationType.REQUEST_RESPONSE,
      payload: taskInput,
      qualifier: 'qualifier',
    });
    
    Docs
    0
  • Powered by Official black Bloop logo with a period
    download the IDE extension

    View other examples