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
  • new tasks.SageMakerCreateModel(this, 'Sagemaker', {
      modelName: 'MyModel',
      primaryContainer: new tasks.ContainerDefinition({
        image: tasks.DockerImage.fromJsonExpression(sfn.JsonPath.stringAt('$.Model.imageName')),
        mode: tasks.Mode.SINGLE_MODEL,
        modelS3Location: tasks.S3Location.fromJsonExpression('$.TrainingJob.ModelArtifacts.S3ModelArtifacts'),
      }),
    });
    
    Docs
    0
  • new tasks.SageMakerCreateModel(this, 'Sagemaker', {
      modelName: 'MyModel',
      primaryContainer: new tasks.ContainerDefinition({
        image: tasks.DockerImage.fromJsonExpression(sfn.JsonPath.stringAt('$.Model.imageName')),
        mode: tasks.Mode.SINGLE_MODEL,
        modelS3Location: tasks.S3Location.fromJsonExpression('$.TrainingJob.ModelArtifacts.S3ModelArtifacts'),
      }),
    });
    
    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
  • const convertToSeconds = new tasks.EvaluateExpression(this, 'Convert to seconds', {
      expression: '$.waitMilliseconds / 1000',
      resultPath: '$.waitSeconds',
    });
    
    const createMessage = new tasks.EvaluateExpression(this, 'Create message', {
      // Note: this is a string inside a string.
      expression: '`Now waiting ${$.waitSeconds} seconds...`',
      runtime: lambda.Runtime.NODEJS_14_X,
      resultPath: '$.message',
    });
    
    const publishMessage = new tasks.SnsPublish(this, 'Publish message', {
      topic: new sns.Topic(this, 'cool-topic'),
      message: sfn.TaskInput.fromJsonPathAt('$.message'),
      resultPath: '$.sns',
    });
    
    const wait = new sfn.Wait(this, 'Wait', {
      time: sfn.WaitTime.secondsPath('$.waitSeconds'),
    });
    
    new sfn.StateMachine(this, 'StateMachine', {
      definition: convertToSeconds
        .next(createMessage)
        .next(publishMessage)
        .next(wait),
    });
    
    Docs
    0
  • // The code below shows an example of how to instantiate this type.
    // The values are placeholders you should change.
    import * as stepfunctions_tasks from '@aws-cdk/aws-stepfunctions-tasks';
    
    const dynamoProjectionExpression = new stepfunctions_tasks.DynamoProjectionExpression();
    
    Docs
    0
  • Powered by Official black Bloop logo with a period
    download the IDE extension

    View other examples