create_state_machine
¶
create_state_machine(
name: Name,
definition: Definition,
role_arn: Arn,
*,
config_overrides: Optional[SFNClientConfig] = None,
type: Optional[StateMachineType] = None,
logging_configuration: Optional[LoggingConfiguration] = None,
tags: Optional[TagList] = None,
tracing_configuration: Optional[TracingConfiguration] = None,
publish: Optional[Publish] = None,
version_description: Optional[VersionDescription] = None,
encryption_configuration: Optional[EncryptionConfiguration] = None,
) -> CreateStateMachineOutput
Creates a state machine. A state machine consists of a collection of states that can do work (Task states), determine to which states to transition next (Choice states), stop an execution with an error (Fail states), and so on. State machines are specified using a JSON-based, structured language. For more information, see Amazon States Language in the Step Functions User Guide.
If you set the publish parameter of this API action to true, it publishes version 1 as the first revision of the state machine.
For additional control over security, you can encrypt your data using a customer-managed key for Step Functions state machines. You can configure a symmetric KMS key and data key reuse period when creating or updating a State Machine. The execution history and state machine definition will be encrypted with the key applied to the State Machine.
This operation is eventually consistent. The results are best effort and may not reflect very recent updates and changes.
CreateStateMachine is an idempotent API. Subsequent requests won’t create a duplicate resource if it was already created. CreateStateMachine's idempotency check is based on the state machine name, definition, type, LoggingConfiguration, TracingConfiguration, and EncryptionConfiguration The check is also based on the publish and versionDescription parameters. If a following request has a different roleArn or tags, Step Functions will ignore these differences and treat it as an idempotent request of the previous. In this case, roleArn and tags will not be updated, even if they are different.
Parameters:
-
name(Name) –The name of the state machine.
A name must not contain:
-
white space
-
brackets
< > { } [ ] -
wildcard characters
? * -
special characters
" # % \ ^ | ~ ` $ & , ; : / -
control characters (
U+0000-001F,U+007F-009F,U+FFFE-FFFF) -
surrogates (
U+D800-DFFF) -
invalid characters (
U+10FFFF)
To enable logging with CloudWatch Logs, the name should only contain 0-9, A-Z, a-z, - and _.
-
-
definition(Definition) –The Amazon States Language definition of the state machine. See Amazon States Language.
-
role_arn(Arn) –The Amazon Resource Name (ARN) of the IAM role to use for this state machine.
-
type(Optional[StateMachineType], default:None) –Determines whether a Standard or Express state machine is created. The default is
STANDARD. You cannot update thetypeof a state machine once it has been created. -
logging_configuration(Optional[LoggingConfiguration], default:None) –Defines what execution history events are logged and where they are logged.
By default, the
levelis set toOFF. For more information see Log Levels in the Step Functions User Guide. -
tags(Optional[TagList], default:None) –Tags to be added when creating a state machine.
An array of key-value pairs. For more information, see Using Cost Allocation Tags in the Amazon Web Services Billing and Cost Management User Guide, and Controlling Access Using IAM Tags.
Tags may only contain Unicode letters, digits, white space, or these symbols:
_ . : / = + - @. -
tracing_configuration(Optional[TracingConfiguration], default:None) –Selects whether X-Ray tracing is enabled.
-
publish(Optional[Publish], default:None) –Set to
trueto publish the first version of the state machine during creation. The default isfalse. -
version_description(Optional[VersionDescription], default:None) –Sets description about the state machine version. You can only set the description if the
publishparameter is set totrue. Otherwise, if you setversionDescription, butpublishtofalse, this API action throwsValidationException. -
encryption_configuration(Optional[EncryptionConfiguration], default:None) –Settings to configure server-side encryption.
Raises:
-
ConflictException–Updating or deleting a resource can cause an inconsistent state. This error occurs when there're concurrent requests for DeleteStateMachineVersion, PublishStateMachineVersion, or UpdateStateMachine with the
publishparameter set totrue.HTTP Status Code: 409
-
InvalidArn–The provided Amazon Resource Name (ARN) is not valid.
-
InvalidDefinition–The provided Amazon States Language definition is not valid.
-
InvalidEncryptionConfiguration–Received when
encryptionConfigurationis specified but various conditions exist which make the configuration invalid. For example, iftypeis set toCUSTOMER_MANAGED_KMS_KEY, butkmsKeyIdis null, orkmsDataKeyReusePeriodSecondsis not between 60 and 900, or the KMS key is not symmetric or inactive. -
InvalidLoggingConfiguration–Configuration is not valid.
-
InvalidName–The provided name is not valid.
-
InvalidTracingConfiguration–Your
tracingConfigurationkey does not match, orenabledhas not been set totrueorfalse. -
KmsAccessDeniedException–Either your KMS key policy or API caller does not have the required permissions.
-
KmsThrottlingException–Received when KMS returns
ThrottlingExceptionfor a KMS call that Step Functions makes on behalf of the caller. -
StateMachineAlreadyExists–A state machine with the same name but a different definition or role ARN already exists.
-
StateMachineDeleting–The specified state machine is being deleted.
-
StateMachineLimitExceeded–The maximum number of state machines has been reached. Existing state machines must be deleted before a new state machine can be created.
-
StateMachineTypeNotSupported–State machine type is not supported.
-
TooManyTags–You've exceeded the number of tags allowed for a resource. See the Limits Topic in the Step Functions Developer Guide.
-
ValidationException–The input does not satisfy the constraints specified by an Amazon Web Services service.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_sfn/_services/sfn.py
326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 | |