Bases: Resource
Define a StepFunctions State Machine.
infused
Example:
import aws_cdk.aws_stepfunctions as stepfunctions
pipeline = codepipeline.Pipeline(self, "MyPipeline")
input_artifact = codepipeline.Artifact()
start_state = stepfunctions.Pass(self, "StartState")
simple_state_machine = stepfunctions.StateMachine(self, "SimpleStateMachine",
definition=start_state
)
step_function_action = codepipeline_actions.StepFunctionInvokeAction(
action_name="Invoke",
state_machine=simple_state_machine,
state_machine_input=codepipeline_actions.StateMachineInput.file_path(input_artifact.at_path("assets/input.json"))
)
pipeline.add_stage(
stage_name="StepFunctions",
actions=[step_function_action]
)
scope (Construct
)
id (str
)
definition (IChainable
) – Definition for this state machine.
logs (Union
[LogOptions
, Dict
[str
, Any
], None
]) – Defines what execution history events are logged and where they are logged. Default: No logging
role (Optional
[IRole
]) – The execution role for the state machine service. Default: A role is automatically created
state_machine_name (Optional
[str
]) – A name for the state machine. Default: A name is automatically generated
state_machine_type (Optional
[StateMachineType
]) – Type of the state machine. Default: StateMachineType.STANDARD
timeout (Optional
[Duration
]) – Maximum run time for this state machine. Default: No timeout
tracing_enabled (Optional
[bool
]) – Specifies whether Amazon X-Ray tracing is enabled for this state machine. Default: false
Methods
Add the given statement to the role’s policy.
statement (PolicyStatement
)
None
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY
), or left in your AWS
account for data recovery and cleanup later (RemovalPolicy.RETAIN
).
policy (RemovalPolicy
)
None
Grant the given identity custom permissions.
identity (IGrantable
)
actions (str
)
Grant the given identity permissions on all executions of the state machine.
identity (IGrantable
)
actions (str
)
Grant the given identity permissions to read results from state machine.
identity (IGrantable
)
Grant the given identity permissions to start an execution of this state machine.
identity (IGrantable
)
Grant the given identity permissions to start a synchronous execution of this state machine.
identity (IGrantable
)
Grant the given identity task response permissions on a state machine.
identity (IGrantable
)
Return the given named metric for this State Machine’s executions.
metric_name (str
)
account (Optional
[str
]) – Account which this metric comes from. Default: - Deployment account.
color (Optional
[str
]) – The hex color code, prefixed with ‘#’ (e.g. ‘#00ff00’), to use when this metric is rendered on a graph. The Color
class has a set of standard colors that can be used here. Default: - Automatic color
dimensions (Optional
[Mapping
[str
, Any
]]) – (deprecated) Dimensions of the metric. Default: - No dimensions.
dimensions_map (Optional
[Mapping
[str
, str
]]) – Dimensions of the metric. Default: - No dimensions.
label (Optional
[str
]) – Label for this metric when added to a Graph in a Dashboard. You can use dynamic labels to show summary information about the entire displayed time series in the legend. For example, if you use:: [max: ${MAX}] MyMetric As the metric label, the maximum value in the visible range will be shown next to the time series name in the graph’s legend. Default: - No label
period (Optional
[Duration
]) – The period over which the specified statistic is applied. Default: Duration.minutes(5)
region (Optional
[str
]) – Region which this metric comes from. Default: - Deployment region.
statistic (Optional
[str
]) – What function to use for aggregating. Can be one of the following: - “Minimum” | “min” - “Maximum” | “max” - “Average” | “avg” - “Sum” | “sum” - “SampleCount | “n” - “pNN.NN” Default: Average
unit (Optional
[Unit
]) – Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
sum over 5 minutes
Metric for the number of executions that were aborted.
account (Optional
[str
]) – Account which this metric comes from. Default: - Deployment account.
color (Optional
[str
]) – The hex color code, prefixed with ‘#’ (e.g. ‘#00ff00’), to use when this metric is rendered on a graph. The Color
class has a set of standard colors that can be used here. Default: - Automatic color
dimensions (Optional
[Mapping
[str
, Any
]]) – (deprecated) Dimensions of the metric. Default: - No dimensions.
dimensions_map (Optional
[Mapping
[str
, str
]]) – Dimensions of the metric. Default: - No dimensions.
label (Optional
[str
]) –
Label for this metric when added to a Graph in a Dashboard. You can use dynamic labels to show summary information about the entire displayed time series in the legend. For example, if you use:: [max: ${MAX}] MyMetric As the metric label, the maximum value in the visible range will be shown next to the time series name in the graph’s legend. Default: - No label
period (Optional
[Duration
]) – The period over which the specified statistic is applied. Default: Duration.minutes(5)
region (Optional
[str
]) – Region which this metric comes from. Default: - Deployment region.
statistic (Optional
[str
]) – What function to use for aggregating. Can be one of the following: - “Minimum” | “min” - “Maximum” | “max” - “Average” | “avg” - “Sum” | “sum” - “SampleCount | “n” - “pNN.NN” Default: Average
unit (Optional
[Unit
]) – Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
sum over 5 minutes
Metric for the number of executions that failed.
account (Optional
[str
]) – Account which this metric comes from. Default: - Deployment account.
color (Optional
[str
]) – The hex color code, prefixed with ‘#’ (e.g. ‘#00ff00’), to use when this metric is rendered on a graph. The Color
class has a set of standard colors that can be used here. Default: - Automatic color
dimensions (Optional
[Mapping
[str
, Any
]]) – (deprecated) Dimensions of the metric. Default: - No dimensions.
dimensions_map (Optional
[Mapping
[str
, str
]]) – Dimensions of the metric. Default: - No dimensions.
label (Optional
[str
]) –
Label for this metric when added to a Graph in a Dashboard. You can use dynamic labels to show summary information about the entire displayed time series in the legend. For example, if you use:: [max: ${MAX}] MyMetric As the metric label, the maximum value in the visible range will be shown next to the time series name in the graph’s legend. Default: - No label
period (Optional
[Duration
]) – The period over which the specified statistic is applied. Default: Duration.minutes(5)
region (Optional
[str
]) – Region which this metric comes from. Default: - Deployment region.
statistic (Optional
[str
]) – What function to use for aggregating. Can be one of the following: - “Minimum” | “min” - “Maximum” | “max” - “Average” | “avg” - “Sum” | “sum” - “SampleCount | “n” - “pNN.NN” Default: Average
unit (Optional
[Unit
]) – Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
sum over 5 minutes
Metric for the number of executions that were started.
account (Optional
[str
]) – Account which this metric comes from. Default: - Deployment account.
color (Optional
[str
]) – The hex color code, prefixed with ‘#’ (e.g. ‘#00ff00’), to use when this metric is rendered on a graph. The Color
class has a set of standard colors that can be used here. Default: - Automatic color
dimensions (Optional
[Mapping
[str
, Any
]]) – (deprecated) Dimensions of the metric. Default: - No dimensions.
dimensions_map (Optional
[Mapping
[str
, str
]]) – Dimensions of the metric. Default: - No dimensions.
label (Optional
[str
]) –
Label for this metric when added to a Graph in a Dashboard. You can use dynamic labels to show summary information about the entire displayed time series in the legend. For example, if you use:: [max: ${MAX}] MyMetric As the metric label, the maximum value in the visible range will be shown next to the time series name in the graph’s legend. Default: - No label
period (Optional
[Duration
]) – The period over which the specified statistic is applied. Default: Duration.minutes(5)
region (Optional
[str
]) – Region which this metric comes from. Default: - Deployment region.
statistic (Optional
[str
]) – What function to use for aggregating. Can be one of the following: - “Minimum” | “min” - “Maximum” | “max” - “Average” | “avg” - “Sum” | “sum” - “SampleCount | “n” - “pNN.NN” Default: Average
unit (Optional
[Unit
]) – Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
sum over 5 minutes
Metric for the number of executions that succeeded.
account (Optional
[str
]) – Account which this metric comes from. Default: - Deployment account.
color (Optional
[str
]) – The hex color code, prefixed with ‘#’ (e.g. ‘#00ff00’), to use when this metric is rendered on a graph. The Color
class has a set of standard colors that can be used here. Default: - Automatic color
dimensions (Optional
[Mapping
[str
, Any
]]) – (deprecated) Dimensions of the metric. Default: - No dimensions.
dimensions_map (Optional
[Mapping
[str
, str
]]) – Dimensions of the metric. Default: - No dimensions.
label (Optional
[str
]) –
Label for this metric when added to a Graph in a Dashboard. You can use dynamic labels to show summary information about the entire displayed time series in the legend. For example, if you use:: [max: ${MAX}] MyMetric As the metric label, the maximum value in the visible range will be shown next to the time series name in the graph’s legend. Default: - No label
period (Optional
[Duration
]) – The period over which the specified statistic is applied. Default: Duration.minutes(5)
region (Optional
[str
]) – Region which this metric comes from. Default: - Deployment region.
statistic (Optional
[str
]) – What function to use for aggregating. Can be one of the following: - “Minimum” | “min” - “Maximum” | “max” - “Average” | “avg” - “Sum” | “sum” - “SampleCount | “n” - “pNN.NN” Default: Average
unit (Optional
[Unit
]) – Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
sum over 5 minutes
Metric for the number of executions that were throttled.
account (Optional
[str
]) – Account which this metric comes from. Default: - Deployment account.
color (Optional
[str
]) – The hex color code, prefixed with ‘#’ (e.g. ‘#00ff00’), to use when this metric is rendered on a graph. The Color
class has a set of standard colors that can be used here. Default: - Automatic color
dimensions (Optional
[Mapping
[str
, Any
]]) – (deprecated) Dimensions of the metric. Default: - No dimensions.
dimensions_map (Optional
[Mapping
[str
, str
]]) – Dimensions of the metric. Default: - No dimensions.
label (Optional
[str
]) –
Label for this metric when added to a Graph in a Dashboard. You can use dynamic labels to show summary information about the entire displayed time series in the legend. For example, if you use:: [max: ${MAX}] MyMetric As the metric label, the maximum value in the visible range will be shown next to the time series name in the graph’s legend. Default: - No label
period (Optional
[Duration
]) – The period over which the specified statistic is applied. Default: Duration.minutes(5)
region (Optional
[str
]) – Region which this metric comes from. Default: - Deployment region.
statistic (Optional
[str
]) – What function to use for aggregating. Can be one of the following: - “Minimum” | “min” - “Maximum” | “max” - “Average” | “avg” - “Sum” | “sum” - “SampleCount | “n” - “pNN.NN” Default: Average
unit (Optional
[Unit
]) – Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
sum over 5 minutes
Metric for the interval, in milliseconds, between the time the execution starts and the time it closes.
account (Optional
[str
]) – Account which this metric comes from. Default: - Deployment account.
color (Optional
[str
]) – The hex color code, prefixed with ‘#’ (e.g. ‘#00ff00’), to use when this metric is rendered on a graph. The Color
class has a set of standard colors that can be used here. Default: - Automatic color
dimensions (Optional
[Mapping
[str
, Any
]]) – (deprecated) Dimensions of the metric. Default: - No dimensions.
dimensions_map (Optional
[Mapping
[str
, str
]]) – Dimensions of the metric. Default: - No dimensions.
label (Optional
[str
]) –
Label for this metric when added to a Graph in a Dashboard. You can use dynamic labels to show summary information about the entire displayed time series in the legend. For example, if you use:: [max: ${MAX}] MyMetric As the metric label, the maximum value in the visible range will be shown next to the time series name in the graph’s legend. Default: - No label
period (Optional
[Duration
]) – The period over which the specified statistic is applied. Default: Duration.minutes(5)
region (Optional
[str
]) – Region which this metric comes from. Default: - Deployment region.
statistic (Optional
[str
]) – What function to use for aggregating. Can be one of the following: - “Minimum” | “min” - “Maximum” | “max” - “Average” | “avg” - “Sum” | “sum” - “SampleCount | “n” - “pNN.NN” Default: Average
unit (Optional
[Unit
]) – Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
average over 5 minutes
Metric for the number of executions that timed out.
account (Optional
[str
]) – Account which this metric comes from. Default: - Deployment account.
color (Optional
[str
]) – The hex color code, prefixed with ‘#’ (e.g. ‘#00ff00’), to use when this metric is rendered on a graph. The Color
class has a set of standard colors that can be used here. Default: - Automatic color
dimensions (Optional
[Mapping
[str
, Any
]]) – (deprecated) Dimensions of the metric. Default: - No dimensions.
dimensions_map (Optional
[Mapping
[str
, str
]]) – Dimensions of the metric. Default: - No dimensions.
label (Optional
[str
]) –
Label for this metric when added to a Graph in a Dashboard. You can use dynamic labels to show summary information about the entire displayed time series in the legend. For example, if you use:: [max: ${MAX}] MyMetric As the metric label, the maximum value in the visible range will be shown next to the time series name in the graph’s legend. Default: - No label
period (Optional
[Duration
]) – The period over which the specified statistic is applied. Default: Duration.minutes(5)
region (Optional
[str
]) – Region which this metric comes from. Default: - Deployment region.
statistic (Optional
[str
]) – What function to use for aggregating. Can be one of the following: - “Minimum” | “min” - “Maximum” | “max” - “Average” | “avg” - “Sum” | “sum” - “SampleCount | “n” - “pNN.NN” Default: Average
unit (Optional
[Unit
]) – Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
sum over 5 minutes
Returns a string representation of this construct.
str
Attributes
The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
The principal this state machine is running as.
The construct tree node associated with this construct.
Execution role of this state machine.
The stack in which this resource is defined.
The ARN of the state machine.
The name of the state machine.
true
Type of the state machine.
true
Static Methods
Import a state machine.
scope (Construct
)
id (str
)
state_machine_arn (str
)
Return whether the given object is a Construct.
x (Any
)
bool
Check whether the given construct is a Resource.
construct (IConstruct
)
bool