Easy ReviewDOP-C02
Configuration Management and IaC25

Step Functions

Coordinate workflow steps with execution guarantees, retries, service integrations, and callbacks.

Este conteúdo de estudo ainda não foi traduzido, então aparece em inglês. Ajude a traduzir

Step Functions defines how tasks, decisions, delays, and external callbacks form a workflow. Choose the execution type and integration pattern before designing failure handling.

Standard and Express workflows

Step Functions runs a workflow, a sequence of steps with rules for moving between them. Its state machineA definition of workflow states and the transitions between them. is the workflow definition; an executionOne run of a state machine. is one run. Choose Standard for long processes and Express for short event processing.

How it works

  1. Select a workflow type when creating the state machine. Standard is the default, and the type is fixed after creation.
  2. Choose execution behavior using the table below. An idempotent actionAn action whose repeated execution does not change its intended outcome. has the same outcome when repeated, so duplicate processing does not change its result.
  3. Start asynchronous Express with StartExecution or synchronous Express with StartSyncExecution when the caller needs to wait for the result.
  4. Inspect state inputs and outputs in execution details. Enable CloudWatch Logs to record Express execution history.
Workflow Execution guarantee Maximum duration Billing basis
Standard Exactly once, unless retries are configured One year State transitionsMovement from one workflow state to the next.
Asynchronous Express At least once Five minutes Executions, duration, memory
Synchronous Express At most once Five minutes Executions, duration, memory

Exam cues

  • If the question says a payment process waits for hours, think Standard, because it supports long runs without implicit task repetition.
  • If the question says a short transformation must return results to its caller, think synchronous Express, because its start call waits for completion.
  • If the question says Express failures need investigation, think enabled CloudWatch Logs, because Express does not retain execution history within Step Functions.

Remember

  • Standard: up to one year and normally 90 days of completed execution history.
  • Express: up to five minutes; design its work to be idempotent.
  • Activities, Distributed Map, job waiting, and task-token callbacks require Standard.

Trap: Synchronous Express starting an execution is different from a Task using .sync. Express does not support the job-waiting integration pattern.

Trap: Standard’s execution guarantee does not prevent the retries you explicitly configure.

Da documentação da AWS (15)
  • A state machine defines a workflow; Standard is the default type, and its type cannot be changed after creation.
  • Standard workflows can run for up to one year.
  • Standard executes tasks and states exactly once unless the workflow explicitly configures retries.
  • Standard execution history is normally retained for 90 days after completion.
  • Standard workflow billing counts state transitions.
  • Express workflows can run for up to five minutes.
  • Asynchronous Express provides at-least-once execution; synchronous Express provides at-most-once execution.
  • StartExecution starts asynchronous Express and returns before completion; StartSyncExecution waits for synchronous Express results.
  • Express billing depends on execution count, duration, and memory consumption.
  • Standard supports activities, Distributed Map, and supported job and callback integrations; Express does not support those features.
  • An idempotent action tolerates repetition without changing the outcome; AWS recommends idempotent work for Express.
  • Execution details expose state inputs and outputs; Express execution history requires CloudWatch Logs logging to be enabled.
  • A Parallel state runs several branches at the same time and continues when all branches finish.
  • Step Functions state types are Task (one unit of work), Choice (branch on input), Parallel (fixed parallel branches), Map (the same steps for each item of an array), Pass, Wait (pause for a time or until a date), and the terminal Succeed and Fail states.
  • Amazon SWF coordinates tasks done by workers that run on EC2 or on premises; for most new workflows AWS recommends Step Functions instead.

Retry and Catch

Step Functions error handling lets a workflow repeat failed work or move to a recovery step. A retrier defines how to try again; a catcher chooses a fallback state after retry handling cannot resolve the error.

How it works

  1. A Task, Parallel, or Map state reports an error. Without effective handling, the executionOne run of a state machine. fails.
  2. Step Functions scans Retry entries in order for a matching ErrorEquals name. BackoffAn increase in the delay between repeated attempts after failure. increases the delay between attempts; jitterRandom variation in retry delay that spreads attempts over time. adds randomness to spread simultaneous retries.
  3. If retries do not resolve the error, Step Functions selects a matching Catch and follows its Next transition.
  4. For JSONPathA path notation used to select fields from JSON data. workflows, put the error under a field such as $.error with ResultPath to preserve the request. The default $ replaces the input with the error.
  5. Handle top-level execution failure in the caller or a parent workflow. EventBridge can react to Standard workflow timeout events.

Exam cues

  • If the question says a dependency has transient failures, think Retry, because the same work may succeed after a delay.
  • If the question says synchronized retries overload a dependency, think JitterStrategy: FULL plus MaxDelaySeconds, because these spread retries and cap their delay.
  • If the question says recovery needs the original request, think Catch ResultPath, because its default replaces the input.

Remember

Retry field Default or effect
IntervalSeconds One second
MaxAttempts Three retries; zero disables retries
BackoffRate 2.0
JitterStrategy NONE; FULL randomizes from zero to the retry interval
MaxDelaySeconds Caps the delay; no cap when omitted
  • States.ALL belongs alone in the last retrier or catcher.
  • States.TaskFailed excludes States.Timeout.

Trap: States.ALL does not handle States.DataLimitExceeded or States.Runtime. Explicitly name States.DataLimitExceeded to catch or retry it. States.Runtime is not retriable.

Da documentação da AWS (15)
  • A state error fails the execution by default when no handling resolves it.
  • Task, Parallel, and Map support Retry and Catch; catchers do not handle top-level execution failures.
  • Step Functions scans retriers in order and uses applicable Retry behavior before selecting a matching Catch transition.
  • IntervalSeconds defaults to one second before the first retry.
  • MaxAttempts defaults to three retries; zero disables retries for that retrier.
  • BackoffRate defaults to 2.0 and multiplies the retry delay after each attempt.
  • MaxDelaySeconds caps the retry interval; without it the retry policy has no delay cap.
  • JitterStrategy defaults to NONE; FULL randomizes each delay between zero and its calculated retry interval.
  • States.ALL must be the sole ErrorEquals entry in the last retrier or catcher.
  • States.ALL does not handle States.DataLimitExceeded or States.Runtime.
  • States.DataLimitExceeded can be caught or retried when explicitly named in ErrorEquals.
  • States.Runtime is not retriable and causes execution failure.
  • States.TaskFailed matches known error names except States.Timeout.
  • In JSONPath workflows, Catch ResultPath can merge error information into original input; its default $ replaces the input.
  • A caller or parent workflow can handle failed child executions; EventBridge can react to Standard workflow timeout events.

Service integration patterns

Step Functions service integrations call work from a state machineA definition of workflow states and the transitions between them., the definition of a workflow. Amazon States LanguageThe JSON-based language used to define Step Functions state machines. (ASL) is the JSON-based language that describes its steps and transitions. The integration pattern determines what completion means: an API response, a finished job, or an external callback.

How it works

  1. Define the work in a Task state. Grant its state machine an IAM execution roleAn IAM role granting a state machine permission to access AWS resources., the permission-bearing identity Step Functions uses to access AWS resources.
  2. Choose the integration pattern below. Only use a job or callback pattern where that integration supports it.
  3. Route results with Choice, delay with Wait, or coordinate concurrent work with Parallel and Map.
Pattern Continue when Workflow support
Request-response The API responds Standard and Express
.sync The supported job finishes Standard
.waitForTaskToken An external process reports using its token Standard
Flow state Purpose
Choice Select a branch from conditions; Default handles no match
Wait Delay for a duration or until a timestamp
Parallel Run different branches and wait for all to terminate
Map Repeat steps for every dataset item

Exam cues

  • If the question says a Batch job must finish before the next step, think .sync on Standard, because submission success only means the API accepted the job.
  • If the question says repeat steps for each record, think Map; if it says run different checks together, think Parallel, because their units of concurrency differ.
  • If the question says wait until a future time, think Wait, because it delays workflow progress without invoking a worker.
  • If the question says coordinate remediation for an exposed IAM access key, think an EventBridge rule matching AWS Health AWS_RISK_CREDENTIALS_EXPOSED and targeting Step Functions, because service events can start a response workflow.

Remember

  • Inline Map is the default: up to 40 concurrent iterations. Distributed Map: up to 10,000 parallel child executionsOne run of a state machine..
  • Same-account .sync monitoring uses polling and EventBridge; cross-account monitoring uses polling only.
  • .sync cancellation is best effort, so an aborted workflow can leave a job running.

Trap: A successful request-response job submission does not mean the background job has completed. Choose a supported .sync integration when completion must precede the next step.

Wait for the job before continuing
submit .sync1complete2Step FunctionsECS taskNext task
  1. Step Functions starts an ECS task using the .sync pattern.

  2. Step Functions waits for the job to finish before invoking the next task.

Da documentação da AWS (16)
  • Amazon States Language is a JSON-based language for defining state machines, their work, and their transitions.
  • A Task represents one unit of work, using an activity, Lambda, a supported service, or an HTTPS API.
  • Request-response proceeds after the API responds and does not wait for a submitted background job to finish.
  • The .sync suffix waits for completion of a supported job, including Batch, ECS, Glue, CodeBuild, or a nested Step Functions execution.
  • The .waitForTaskToken suffix waits for an external process to return its task token using SendTaskSuccess or SendTaskFailure.
  • Express supports request-response only; Standard also supports job and callback patterns for integrations that provide them.
  • Same-account .sync monitoring uses API polling and EventBridge events; cross-account .sync uses polling only.
  • When a .sync task is aborted, cancellation is best effort and the external job can keep running.
  • Choice selects a branch by evaluating conditions; no match without a Default causes an error.
  • Wait delays execution for a duration or until a timestamp without invoking a worker for the delay.
  • Parallel runs separate branches concurrently and waits for all branches to terminate before continuing.
  • Map repeats a set of steps for each input item; Inline is the default mode and Distributed runs child workflows.
  • Inline Map supports up to 40 concurrent iterations; Distributed Map supports up to 10,000 parallel child workflow executions.
  • The state machine IAM execution role grants permission to call integrated AWS resources.
  • An EventBridge rule can target a Step Functions state machine and start a workflow when another service event matches.
  • AWS Health emits AWS_RISK_CREDENTIALS_EXPOSED when AWS detects an exposed IAM access key; AWS documents routing that event to a Step Functions remediation workflow.

Task token callbacks

A Step Functions callback task pauses a Standard workflow while an external process works. Its task tokenA unique value that associates an external completion response with a waiting task. is a unique value linking the worker’s response to the waiting task, so human approval or a legacy process can complete later.

How it works

  1. Select a supported .waitForTaskToken integration. For JSONPathA path notation used to select fields from JSON data., read $$.Task.Token from the Context objectAn internal object containing execution and task information., the executionOne run of a state machine.’s internal information object.
  2. Pass the token to the worker. With sqs:sendMessage.waitForTaskToken, put it in the message body; the external consumer reads that message.
  3. Set HeartbeatSeconds to bound silence between heartbeatsA signal that a worker is still active while its task waits to finish. and TimeoutSeconds to bound total task runtime. SendTaskHeartbeat keeps the heartbeat interval active.
  4. Call SendTaskSuccess or SendTaskFailure with the token using a principal, an AWS identity, in the state machineA definition of workflow states and the transitions between them.’s account.
  5. If the task times out and is retried, supply the new task token to the worker.

Exam cues

  • If the question says wait for a person to approve, think a Standard callback task, because completion arrives from an external process.
  • If the question says an external worker polls a queue, think an SQS message carrying the task token, because the worker must associate its response with the waiting task.
  • If the question says callbacks use a different account’s credentials, think same-account principal, because task tokens do not work with a principal in another account.

Remember

  • JSONPath token path: $$.Task.Token.
  • Completion: SendTaskSuccess or SendTaskFailure; heartbeats do not complete work.
  • Callback tasks have no default task timeout. The enclosing Standard execution can last up to one year.

Trap: Regular heartbeats do not extend TimeoutSeconds. Set both the heartbeat interval and the overall deadline.

Step Functions callback with a task token
send token1poll2SendTaskSuccess3Step FunctionsStandard callbackiSQS queuemessage carries tokeniExternal workerhuman or legacy systemi
  1. The task state calls SQS sendMessage.waitForTaskToken and passes the token in the message body, then pauses.

  2. An external consumer reads the message and starts its work.

  3. The consumer calls SendTaskSuccess or SendTaskFailure with the token. SendTaskHeartbeat keeps the heartbeat interval active but does not complete the task.

Detalhes das caixas (3)
Step Functions

A supported .waitForTaskToken task pauses for a callback. JSONPath reads the token from $$.Task.Token. Configure a heartbeat and overall task timeout.

SQS queue

The SQS message body carries the task token for an external consumer.

External worker

The worker returns the token using a principal in the same AWS account as the state machine.

Da documentação da AWS (8)
  • A supported .waitForTaskToken task in a Standard workflow waits for an external process such as an approval or legacy worker.
  • JSONPath task parameters can read the task token from $$.Task.Token in the execution Context object.
  • The SQS sendMessage.waitForTaskToken integration can send a token in the message body for an external consumer.
  • SendTaskSuccess or SendTaskFailure with the token completes the waiting task with success or failure.
  • A task-token callback must use a principal in the same AWS account as the state machine.
  • HeartbeatSeconds limits the gap between heartbeats; SendTaskHeartbeat keeps the task active without completing it.
  • TimeoutSeconds limits total task runtime; callback tasks have no default task timeout and can wait until the one-year Standard execution limit.
  • When a callback task times out and is retried, its replacement token is newly generated.

Activities, variables, and terminal states

Step Functions can coordinate work pulled by an activity workerA program that polls for an activity task and returns its result with a task token., retain values for later states, and control how a workflow ends. These features separate task executionOne run of a state machine., data handling, and completion.

How it works

  1. An activity worker polls GetActivityTask with the activity ARN. It receives input and a task tokenA unique value that associates an external completion response with a waiting task., then uses the token with SendTaskSuccess or SendTaskFailure to report the result.
  2. Store a result in a workflow variableA named stored value that later workflow steps can reference. for a later step without passing it through every intermediate state output.
  3. Use Pass to forward input without doing work, or to transform or add output data. Succeed ends a workflow, branch, or iteration successfully. Fail stops execution with failure unless enclosing error handling catches it.

Exam cues

  • If the question says an on-premises worker pulls tasks when it has capacity, think activity, because the worker polls for input and reports the result with its task token.
  • If the question says keep an API result for a later step, think workflow variables, because intermediate states need not pass the value through their outputs.
  • If the question says transform data without external work, think Pass. If it says explicitly end successfully or signal failure, think Succeed or Fail, respectively.

Remember

  • GetActivityTask uses the activity ARN; the response includes input and a task token.
  • SendTaskSuccess and SendTaskFailure use the task token to report the result.
  • Fail stops execution with failure unless enclosing error handling catches it.

Trap: Pass handles data without doing work; it does not report an activity result. The worker reports success or failure using the task token.

Da documentação da AWS (5)
  • An activity worker polls GetActivityTask with the activity ARN, receives input and a taskToken, then reports using SendTaskSuccess or SendTaskFailure.
  • Workflow variables store values for later steps without passing them through every intermediate state output.
  • Pass forwards input without doing work and can transform or add data to output.
  • Succeed ends a workflow, branch, or iteration successfully.
  • Fail stops execution with failure unless enclosing error handling catches it.

Flashcards

toque para virar
Resposta

·

Todos os 25 flashcards em lista

How do Step Functions Standard and Express differ in duration, history, billing, and integrations?

Standard: up to one year, normally 90-day history, billed per state transition, with supported job and callback patterns. Express: up to five minutes, history through enabled CloudWatch Logs, billed by executions, duration, and memory; request-response only.

What execution guarantees do Step Functions Standard, asynchronous Express, and synchronous Express provide?

Standard: exactly once unless retries are configured. Asynchronous Express: at least once. Synchronous Express: at most once. Use idempotent work for Express.

A Step Functions payment workflow can wait several hours and must avoid implicit duplicate task execution. Which workflow type fits?

Standard. It supports long executions and does not repeat tasks unless retries are configured. Make payment retry handling deliberate.

A short Step Functions transformation must return its result directly to an API caller. Which Express start API fits?

StartSyncExecution. Synchronous Express waits for completion and returns results; the workflow must finish within five minutes.

A Step Functions Express workflow fails, but its execution history is unavailable. What should the team configure?

Enable CloudWatch Logs for the Express state machine. Use execution details to inspect individual state inputs and outputs.

A Step Functions workflow must run three independent checks at the same time and continue when all finish. Which state type fits?

A Parallel state.

A workflow must run the same processing steps for every file listed in its input, and pause until a set date before reporting. Which Step Functions states fit?

A Map state for the per-file steps and a Wait state for the pause. Parallel runs fixed branches, and Choice picks one branch from the input.

An exam option offers Amazon SWF for a new workflow. When does SWF still fit, and what does AWS recommend first?

SWF coordinates tasks run by workers on EC2 or on premises. For most new workflows AWS recommends Step Functions.

How do Retry and Catch work together in a Step Functions Task state?

Retry runs first. If it cannot resolve the error, a matching Catch selects its Next state. Retry defaults are IntervalSeconds 1, MaxAttempts 3, and BackoffRate 2.0. In JSONPath, use Catch ResultPath to preserve input and add the error.

What are the rules and exclusions for States.ALL in Step Functions Retry and Catch?

Place States.ALL alone in ErrorEquals in the last retrier or catcher. It does not handle States.DataLimitExceeded or States.Runtime. Explicitly naming States.DataLimitExceeded permits handling it; States.TaskFailed excludes States.Timeout.

What happens when a Step Functions state fails without effective Retry or Catch handling?

The execution fails. Task, Parallel, and Map can have catchers, but top-level execution failures need handling by the caller, a parent workflow, or external event handling.

Many Step Functions tasks retry a throttled dependency together. Which retry options spread retries and limit their delay?

JitterStrategy: FULL and MaxDelaySeconds. Full jitter randomizes delays; MaxDelaySeconds caps the calculated interval.

A Step Functions recovery state needs both the original request and the error. What should a JSONPath Catch configure?

A ResultPath such as $.error. This adds the error to the input; leaving ResultPath at its default $ replaces the input.

How do Step Functions request-response, .sync, and .waitForTaskToken integrations differ?

Request-response waits for the API response. .sync waits for a supported job to finish. .waitForTaskToken waits for a token callback. Express supports request-response only.

A team chains Lambda functions and needs branching, retries, and delays between calls. How should it coordinate the process?

Define a Step Functions state machine in Amazon States Language. Task states call the functions; Choice selects branches and Wait implements delays without a worker.

A Step Functions workflow must process each item in an array, then run two different checks concurrently. Which states fit?

Map repeats the processing steps for each item. Parallel runs the different checks in separate branches and joins after all branches terminate.

A Step Functions state machine definition calls a service, but the call is denied. Which identity needs permission?

The state machine IAM execution role. Its policies must authorize access to the integrated AWS resource.

A team must coordinate credential remediation after AWS Health reports an exposed IAM access key. How can it start a Step Functions workflow?

Match AWS_RISK_CREDENTIALS_EXPOSED with an EventBridge rule targeting the remediation state machine. The workflow can coordinate the response tasks.

A Step Functions workflow must wait for a human approval before continuing. What should the team use?

A supported .waitForTaskToken task in a Standard workflow. Pass the task token, then report approval or rejection with SendTaskSuccess or SendTaskFailure. Set heartbeat and overall task timeouts.

An external worker tries to complete a Step Functions callback task using credentials from another AWS account. Why does its token not work?

Task-token calls require a principal in the state machine account. Arrange for the callback caller to use a permitted principal in that account.

A Step Functions approval worker sends heartbeats, but its task never advances. Which call completes it?

SendTaskSuccess or SendTaskFailure with the token. SendTaskHeartbeat only keeps the heartbeat interval active and does not complete the task.

Which Step Functions timeout bounds total callback task duration even when the worker keeps sending heartbeats?

TimeoutSeconds. HeartbeatSeconds limits the gap between heartbeats; it does not replace the overall task timeout.

An on-premises worker must pull Step Functions work when it has capacity. How does an activity supply and complete a task?

Poll GetActivityTask using the activity ARN. Process the returned input and use its taskToken in SendTaskSuccess or SendTaskFailure.

A Step Functions workflow must keep an API result for a later step without forwarding it through every intermediate step. What feature fits?

Workflow variables. Store the result once and reference it in later steps.

Which Step Functions states transform data without external work and explicitly end a workflow?

Pass forwards or transforms data. Succeed ends successfully; Fail ends with failure unless enclosing error handling catches it.

Você concluiu todos os tópicos da DOP-C02!

Seu badge ficou dourado. Próximo passo: agendar a prova na AWS. Depois de passar, adicione-se ao Quem passou.

Compartilhar

Conte que você concluiu esta certificação

Concluí todos os tópicos da AWS Certified DevOps Engineer - Professional (DOP-C02) no Easy Review. Venha estudar também!