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

  • new tasks.EmrCreateCluster(this, 'Create Cluster', {
      instances: {},
      name: sfn.TaskInput.fromJsonPathAt('$.ClusterName').value,
      stepConcurrencyLevel: 10,
    });
    
    Docs
    0
  • 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
  • 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
  • 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.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 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
  • 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
  • // Define a state machine with one Pass state
    const child = new sfn.StateMachine(this, 'ChildStateMachine', {
      definition: sfn.Chain.start(new sfn.Pass(this, 'PassState')),
    });
    
    // Include the state machine in a Task state with callback pattern
    const task = new tasks.StepFunctionsStartExecution(this, 'ChildTask', {
      stateMachine: child,
      integrationPattern: sfn.IntegrationPattern.WAIT_FOR_TASK_TOKEN,
      input: sfn.TaskInput.fromObject({
        token: sfn.JsonPath.taskToken,
        foo: 'bar',
      }),
      name: 'MyExecutionName',
    });
    
    // Define a second state machine with the Task state above
    new sfn.StateMachine(this, 'ParentStateMachine', {
      definition: task,
    });
    
    Docs
    0
  • import * as codebuild from '@aws-cdk/aws-codebuild';
    
    const codebuildProject = new codebuild.Project(this, 'Project', {
      projectName: 'MyTestProject',
      buildSpec: codebuild.BuildSpec.fromObject({
        version: '0.2',
        phases: {
          build: {
            commands: [
              'echo "Hello, CodeBuild!"',
            ],
          },
        },
      }),
    });
    
    const task = new tasks.CodeBuildStartBuild(this, 'Task', {
      project: codebuildProject,
      integrationPattern: sfn.IntegrationPattern.RUN_JOB,
      environmentVariablesOverride: {
        ZONE: {
          type: codebuild.BuildEnvironmentVariableType.PLAINTEXT,
          value: sfn.JsonPath.stringAt('$.envVariables.zone'),
        },
      },
    });
    
    Docs
    0
  • // The code below shows an example of how to instantiate this type.
    // The values are placeholders you should change.
    import * as stepfunctions from '@aws-cdk/aws-stepfunctions';
    import * as stepfunctions_tasks from '@aws-cdk/aws-stepfunctions-tasks';
    
    declare const input: any;
    declare const stateMachine: stepfunctions.StateMachine;
    
    const startExecution = new stepfunctions_tasks.StartExecution(stateMachine, /* all optional props */ {
      input: {
        inputKey: input,
      },
      integrationPattern: stepfunctions.ServiceIntegrationPattern.FIRE_AND_FORGET,
      name: 'name',
    });
    
    Docs
    0
  • Powered by Official black Bloop logo with a period
    download the IDE extension

    View other examples