# StepFunctionsStartExecution

Use an AWS Step function as a target for AWS EventBridge Scheduler.

Extends: [ScheduleTargetBase](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_scheduler_targets.ScheduleTargetBase.html) › StepFunctionsStartExecution
Implements: [IScheduleTarget](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_scheduler.IScheduleTarget.html)

- Source: [`aws-scheduler-targets/lib/stepfunctions-start-execution.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-scheduler-targets/lib/stepfunctions-start-execution.ts#L10)
- Type last changed: v2.186.0 · 27 Mar 2025

## Example

TypeScript:

```ts
import * as sfn from 'aws-cdk-lib/aws-stepfunctions';
import * as tasks from 'aws-cdk-lib/aws-stepfunctions-tasks';

const payload = {
  Name: "MyParameter",
  Value: '🌥️',
};

const putParameterStep = new tasks.CallAwsService(this, 'PutParameter', {
  service: 'ssm',
  action: 'putParameter',
  iamResources: ['*'],
  parameters: {
    "Name.$": '$.Name',
    "Value.$": '$.Value',
    Type: 'String',
    Overwrite: true,
  },
});

const stateMachine = new sfn.StateMachine(this, 'StateMachine', {
  definitionBody: sfn.DefinitionBody.fromChainable(putParameterStep)
});

new Schedule(this, 'Schedule', {
  schedule: ScheduleExpression.rate(Duration.hours(1)),
  target: new targets.StepFunctionsStartExecution(stateMachine, {
    input: ScheduleTargetInput.fromObject(payload),
  }),
});
```

Python:

```python
import aws_cdk.aws_stepfunctions as sfn
import aws_cdk.aws_stepfunctions_tasks as tasks

payload = {
    "Name": "MyParameter",
    "Value": "🌥️"
}

put_parameter_step = tasks.CallAwsService(self, "PutParameter",
    service="ssm",
    action="putParameter",
    iam_resources=["*"],
    parameters={
        "Name.$": "$.Name",
        "Value.$": "$.Value",
        "Type": "String",
        "Overwrite": True
    }
)

state_machine = sfn.StateMachine(self, "StateMachine",
    definition_body=sfn.DefinitionBody.from_chainable(put_parameter_step)
)

Schedule(self, "Schedule",
    schedule=ScheduleExpression.rate(Duration.hours(1)),
    target=targets.StepFunctionsStartExecution(state_machine,
        input=ScheduleTargetInput.from_object(payload)
    )
)
```

Java:

```java
import software.amazon.awscdk.services.stepfunctions.*;
import software.amazon.awscdk.services.stepfunctions.tasks.*;

Map<String, String> payload = Map.of(
        "Name", "MyParameter",
        "Value", "🌥️");

CallAwsService putParameterStep = CallAwsService.Builder.create(this, "PutParameter")
        .service("ssm")
        .action("putParameter")
        .iamResources(List.of("*"))
        .parameters(Map.of(
                "Name.$", "$.Name",
                "Value.$", "$.Value",
                "Type", "String",
                "Overwrite", true))
        .build();

StateMachine stateMachine = StateMachine.Builder.create(this, "StateMachine")
        .definitionBody(DefinitionBody.fromChainable(putParameterStep))
        .build();

Schedule.Builder.create(this, "Schedule")
        .schedule(ScheduleExpression.rate(Duration.hours(1)))
        .target(StepFunctionsStartExecution.Builder.create(stateMachine)
                .input(ScheduleTargetInput.fromObject(payload))
                .build())
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
using Amazon.CDK.AWS.StepFunctions;
using Amazon.CDK.AWS.StepFunctions.Tasks;

IDictionary<string, string> payload = new Dictionary<string, string> {
    { "Name", "MyParameter" },
    { "Value", "🌥️" }
};

var putParameterStep = new CallAwsService(this, "PutParameter", new CallAwsServiceProps {
    Service = "ssm",
    Action = "putParameter",
    IamResources = new [] { "*" },
    Parameters = new Dictionary<string, object> {
        { "Name.$", "$.Name" },
        { "Value.$", "$.Value" },
        { "Type", "String" },
        { "Overwrite", true }
    }
});

var stateMachine = new StateMachine(this, "StateMachine", new StateMachineProps {
    DefinitionBody = DefinitionBody.FromChainable(putParameterStep)
});

new Schedule(this, "Schedule", new ScheduleProps {
    Schedule = ScheduleExpression.Rate(Duration.Hours(1)),
    Target = new StepFunctionsStartExecution(stateMachine, new ScheduleTargetBaseProps {
        Input = ScheduleTargetInput.FromObject(payload)
    })
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
import "github.com/aws/aws-cdk-go/awscdk"
import tasks "github.com/aws/aws-cdk-go/awscdk"

payload := map[string]*string{
	"Name": jsii.String("MyParameter"),
	"Value": jsii.String("🌥️"),
}

putParameterStep := tasks.NewCallAwsService(this, jsii.String("PutParameter"), &CallAwsServiceProps{
	Service: jsii.String("ssm"),
	Action: jsii.String("putParameter"),
	IamResources: []*string{
		jsii.String("*"),
	},
	Parameters: map[string]interface{}{
		"Name.$": jsii.String("$.Name"),
		"Value.$": jsii.String("$.Value"),
		"Type": jsii.String("String"),
		"Overwrite": jsii.Boolean(true),
	},
})

stateMachine := sfn.NewStateMachine(this, jsii.String("StateMachine"), &StateMachineProps{
	DefinitionBody: sfn.DefinitionBody_FromChainable(putParameterStep),
})

awscdk.NewSchedule(this, jsii.String("Schedule"), &ScheduleProps{
	Schedule: awscdk.ScheduleExpression_Rate(awscdk.Duration_Hours(jsii.Number(1))),
	Target: targets.NewStepFunctionsStartExecution(stateMachine, &ScheduleTargetBaseProps{
		Input: awscdk.ScheduleTargetInput_FromObject(payload),
	}),
})
```

## Initializer

TypeScript:

```ts
new StepFunctionsStartExecution(stateMachine: IStateMachine, props: ScheduleTargetBaseProps)
```

Python:

```python
StepFunctionsStartExecution(state_machine: IStateMachine, props: ScheduleTargetBaseProps)
```

Java:

```java
new StepFunctionsStartExecution(IStateMachine stateMachine, ScheduleTargetBaseProps props)
```

C# / .NET:

```csharp
new StepFunctionsStartExecution(IStateMachine stateMachine, ScheduleTargetBaseProps props)
```

Golang:

```go
NewStepFunctionsStartExecution(StateMachine IStateMachine, Props ScheduleTargetBaseProps)
```

## Methods

- `bind(schedule: ISchedule): ScheduleTargetConfig` — Create a return a Schedule Target Configuration for the given schedule.

  **Returns:** a Schedule Target Configuration
