|
| 1 | +--- |
| 2 | +subcategory: "SFN (Step Functions)" |
| 3 | +layout: "aws" |
| 4 | +page_title: "AWS: aws_sfn_start_execution" |
| 5 | +description: |- |
| 6 | + Starts a Step Functions state machine execution with the specified input data. |
| 7 | +--- |
| 8 | + |
| 9 | + |
| 10 | +<!-- Please do not edit this file, it is generated. --> |
| 11 | +# Action: aws_sfn_start_execution |
| 12 | + |
| 13 | +~> **Note:** `aws_sfn_start_execution` is in beta. Its interface and behavior may change as the feature evolves, and breaking changes are possible. It is offered as a technical preview without compatibility guarantees until Terraform 1.14 is generally available. |
| 14 | + |
| 15 | +Starts a Step Functions state machine execution with the specified input data. This action allows for imperative execution of state machines with full control over execution parameters. |
| 16 | + |
| 17 | +For information about AWS Step Functions, see the [AWS Step Functions Developer Guide](https://docs.aws.amazon.com/step-functions/latest/dg/). For specific information about starting executions, see the [StartExecution](https://docs.aws.amazon.com/step-functions/latest/apireference/API_StartExecution.html) page in the AWS Step Functions API Reference. |
| 18 | + |
| 19 | +~> **Note:** For `STANDARD` workflows, executions with the same name and input are idempotent. For `EXPRESS` workflows, each execution is unique regardless of name and input. |
| 20 | + |
| 21 | +## Example Usage |
| 22 | + |
| 23 | +### Basic Usage |
| 24 | + |
| 25 | +```python |
| 26 | +# DO NOT EDIT. Code generated by 'cdktf convert' - Please report bugs at https://cdk.tf/bug |
| 27 | +from cdktf import TerraformResourceLifecycle |
| 28 | +from constructs import Construct |
| 29 | +from cdktf import Fn, Token, DataResource, TerraformStack |
| 30 | +# |
| 31 | +# Provider bindings are generated by running `cdktf get`. |
| 32 | +# See https://cdk.tf/provider-generation for more details. |
| 33 | +# |
| 34 | +from imports.aws.sfn_state_machine import SfnStateMachine |
| 35 | +class MyConvertedCode(TerraformStack): |
| 36 | + def __init__(self, scope, name): |
| 37 | + super().__init__(scope, name) |
| 38 | + SfnStateMachine(self, "example", |
| 39 | + definition=Token.as_string( |
| 40 | + Fn.jsonencode({ |
| 41 | + "Comment": "A simple minimal example", |
| 42 | + "StartAt": "Hello", |
| 43 | + "States": { |
| 44 | + "Hello": { |
| 45 | + "End": True, |
| 46 | + "Result": "Hello World!", |
| 47 | + "Type": "Pass" |
| 48 | + } |
| 49 | + } |
| 50 | + })), |
| 51 | + name="example-state-machine", |
| 52 | + role_arn=sfn.arn |
| 53 | + ) |
| 54 | + terraform_data_example = DataResource(self, "example_1", |
| 55 | + input="trigger-execution", |
| 56 | + lifecycle=TerraformResourceLifecycle( |
| 57 | + action_trigger=[{ |
| 58 | + "actions": [aws_sfn_start_execution.example], |
| 59 | + "events": [before_create, before_update] |
| 60 | + } |
| 61 | + ] |
| 62 | + ) |
| 63 | + ) |
| 64 | + # This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match. |
| 65 | + terraform_data_example.override_logical_id("example") |
| 66 | +``` |
| 67 | + |
| 68 | +### Named Execution |
| 69 | + |
| 70 | +```python |
| 71 | +# DO NOT EDIT. Code generated by 'cdktf convert' - Please report bugs at https://cdk.tf/bug |
| 72 | +from constructs import Construct |
| 73 | +from cdktf import TerraformStack |
| 74 | +class MyConvertedCode(TerraformStack): |
| 75 | + def __init__(self, scope, name): |
| 76 | + super().__init__(scope, name) |
| 77 | +``` |
| 78 | + |
| 79 | +### Execution with Version |
| 80 | + |
| 81 | +```python |
| 82 | +# DO NOT EDIT. Code generated by 'cdktf convert' - Please report bugs at https://cdk.tf/bug |
| 83 | +from constructs import Construct |
| 84 | +from cdktf import TerraformStack |
| 85 | +class MyConvertedCode(TerraformStack): |
| 86 | + def __init__(self, scope, name): |
| 87 | + super().__init__(scope, name) |
| 88 | +``` |
| 89 | + |
| 90 | +### Execution with Alias |
| 91 | + |
| 92 | +```python |
| 93 | +# DO NOT EDIT. Code generated by 'cdktf convert' - Please report bugs at https://cdk.tf/bug |
| 94 | +from constructs import Construct |
| 95 | +from cdktf import TerraformStack |
| 96 | +# |
| 97 | +# Provider bindings are generated by running `cdktf get`. |
| 98 | +# See https://cdk.tf/provider-generation for more details. |
| 99 | +# |
| 100 | +from imports.aws.sfn_alias import SfnAlias |
| 101 | +class MyConvertedCode(TerraformStack): |
| 102 | + def __init__(self, scope, name, *, stateMachineVersionArn, weight): |
| 103 | + super().__init__(scope, name) |
| 104 | + SfnAlias(self, "prod", |
| 105 | + name="PROD", |
| 106 | + routing_configuration=[SfnAliasRoutingConfiguration( |
| 107 | + state_machine_version_weight=[{ |
| 108 | + "state_machine_version_arn": example.arn, |
| 109 | + "weight": 100 |
| 110 | + } |
| 111 | + ], |
| 112 | + state_machine_version_arn=state_machine_version_arn, |
| 113 | + weight=weight |
| 114 | + ) |
| 115 | + ], |
| 116 | + state_machine_arn=example.arn |
| 117 | + ) |
| 118 | +``` |
| 119 | + |
| 120 | +### X-Ray Tracing |
| 121 | + |
| 122 | +```python |
| 123 | +# DO NOT EDIT. Code generated by 'cdktf convert' - Please report bugs at https://cdk.tf/bug |
| 124 | +from constructs import Construct |
| 125 | +from cdktf import TerraformStack |
| 126 | +class MyConvertedCode(TerraformStack): |
| 127 | + def __init__(self, scope, name): |
| 128 | + super().__init__(scope, name) |
| 129 | +``` |
| 130 | + |
| 131 | +### CI/CD Pipeline Integration |
| 132 | + |
| 133 | +Use this action in your deployment pipeline to trigger post-deployment workflows: |
| 134 | + |
| 135 | +```python |
| 136 | +# DO NOT EDIT. Code generated by 'cdktf convert' - Please report bugs at https://cdk.tf/bug |
| 137 | +from cdktf import TerraformResourceLifecycle |
| 138 | +from constructs import Construct |
| 139 | +from cdktf import DataResource, TerraformStack |
| 140 | +class MyConvertedCode(TerraformStack): |
| 141 | + def __init__(self, scope, name): |
| 142 | + super().__init__(scope, name) |
| 143 | + DataResource(self, "deploy_complete", |
| 144 | + depends_on=[processors], |
| 145 | + input=deployment_id, |
| 146 | + lifecycle=TerraformResourceLifecycle( |
| 147 | + action_trigger=[{ |
| 148 | + "actions": [aws_sfn_start_execution.post_deploy], |
| 149 | + "events": [before_create, before_update] |
| 150 | + } |
| 151 | + ] |
| 152 | + ) |
| 153 | + ) |
| 154 | +``` |
| 155 | + |
| 156 | +### Environment-Specific Processing |
| 157 | + |
| 158 | +```python |
| 159 | +# DO NOT EDIT. Code generated by 'cdktf convert' - Please report bugs at https://cdk.tf/bug |
| 160 | +from constructs import Construct |
| 161 | +from cdktf import TerraformStack |
| 162 | +class MyConvertedCode(TerraformStack): |
| 163 | + def __init__(self, scope, name): |
| 164 | + super().__init__(scope, name) |
| 165 | +``` |
| 166 | + |
| 167 | +### Complex Workflow Orchestration |
| 168 | + |
| 169 | +```python |
| 170 | +# DO NOT EDIT. Code generated by 'cdktf convert' - Please report bugs at https://cdk.tf/bug |
| 171 | +from constructs import Construct |
| 172 | +from cdktf import TerraformStack |
| 173 | +class MyConvertedCode(TerraformStack): |
| 174 | + def __init__(self, scope, name): |
| 175 | + super().__init__(scope, name) |
| 176 | +``` |
| 177 | + |
| 178 | +## Argument Reference |
| 179 | + |
| 180 | +This action supports the following arguments: |
| 181 | + |
| 182 | +* `input` - (Optional) JSON input data for the execution. Must be valid JSON. Defaults to `{}` if not specified. The input size limit is 256 KB. |
| 183 | +* `name` - (Optional) Name of the execution. Must be unique within the account/region/state machine for 90 days. If not provided, Step Functions automatically generates a UUID. Names must not contain whitespace, brackets, wildcards, or special characters. |
| 184 | +* `state_machine_arn` - (Required) ARN of the state machine to execute. Can be an unqualified ARN, version-qualified ARN (e.g., `arn:aws:states:region:account:stateMachine:name:version`), or alias-qualified ARN (e.g., `arn:aws:states:region:account:stateMachine:name:alias`). |
| 185 | +* `trace_header` - (Optional) AWS X-Ray trace header for distributed tracing. Used to correlate execution traces across services. |
| 186 | + |
| 187 | +<!-- cache-key: cdktf-0.20.8 input-f50fb55ee205b83bb20f487d54e45117cd2994b0cffa9684ab55b6deaddea547 --> |
0 commit comments