Module 11 - Defining Workflows To Orchestrate Functions
Module 11 - Defining Workflows To Orchestrate Functions
Contents
Module 11: Defining Workflows to Orchestrate Functions 4
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 3
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 4
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
Section 1: Introduction
Module 11: Defining Workflows to Orchestrate Functions
Section 1: Introduction.
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 5
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
Module objectives
At the end of this module, you should be able to do the following:
• Recognize the dynamics of workflow coordination in distributed applications
• Describe AWS Step Functions
• Identify state types
• Indicate common use cases for Step Functions
• Recall Step Functions API operations
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 6
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
Module overview
Sections Demonstration
• Creating Simple Calculators by Using Step
1. Introduction Functions
2. Coordinating tasks in distributed
applications Lab
• Lab: Orchestrating Serverless Functions with
3. Introducing Step Functions Step Function
4. State types
Finally, you will complete a knowledge check to test your understanding of key
concepts covered in this module.
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 7
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
Now that the coffee inventory is automatically updated on the café website, Frank
would like to be able to request reports with the latest inventory information. Sofía
thinks she can use Step Functions to coordinate the steps to generate a report.
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 8
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
The diagram on this slide gives an overview of the application that you will build
through the labs in this course. The highlighted portions are relevant to this module.
As highlighted in the diagram, you will create a Step Functions workflow and integrate
it with a REST API. The workflow will coordinate the tasks of getting data from the
database, generating a report, posting it to Amazon Simple Storage Service (Amazon
S3), and sending a notification through Amazon SNS.
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 9
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 10
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 11
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
As your application grows in size, the number of components increases and you can
have many patterns to run tasks. For example, consider a serverless application that
is built by using AWS Lambda functions. You might want to invoke a Lambda function
immediately after another function, and only if the first function runs successfully.
You might want two functions to be invoked in parallel and then feed the combined
results into a third function. Or you might want to choose which of two functions is
invoked based on the output of another function.
Function invocation can result in an error for several reasons. Your code might raise
an exception, time out, or run out of memory. The runtime that runs your code might
encounter an error and stop. When an error occurs, your code might have run
completely, partially, or not at all. In most cases, the client or service that invokes
your function automatically retries if it encounters an error. Therefore, your code
must be able to process the same event repeatedly without unwanted effects. If your
function manages resources or writes to a database, you must handle cases where
the same request is made several times.
You need a way to coordinate the components of your application. This coordination
layer is necessary to provide the capability to scale automatically in response to
changing workloads, and to handle errors and timeouts. It must also maintain the
state of your application while it’s running. For example, it must track what step it’s in
and store data that is moving between the steps of your workflow. These features will
help you build and operate your applications. You also want visibility into your
application so that you can troubleshoot errors and track performance.
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 12
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
10
The following are the key takeaways from this section of the module:
• Microservices are smaller, independent components that make up an application
in modern cloud architecture.
• You can use microservices to quickly deploy, scale, and update application
components.
• A coordination layer is necessary to handle automatic scaling, errors, and
timeouts.
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 13
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
11
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 14
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
AWS Step Functions is a web service that you can use to coordinate components of
distributed applications and microservices by using visual workflows. Step Functions
provides a reliable way to coordinate components and step through the functions of
your application. Step Functions offers a graphical console so that you can visualize
the components of your application as a series of steps. It automatically triggers and
tracks each step, and it also retries when errors occur, so your application runs in
order and as expected. Step Functions logs the state of each step, so you can
diagnose and debug problems quickly.
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 15
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
13
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 16
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
Workflow options
Step Functions manages the logic of your application for you and implements basic
data types, such as running tasks sequentially and in parallel, branching, and
timeouts. This process removes extra code that might be repeated in your
microservices and functions. Step Functions automatically handles errors and
exceptions with built-in try/catch and retry, whether the task takes seconds or
months to complete. You can automatically retry failed or timed-out tasks, respond
differently to different error types, and recover gracefully by returning to designated
cleanup and recovery code.
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 17
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
15
With Step Functions, you define a workflow as a series of steps and transitions
between each step. A workflow is also called a state machine, and states are
elements in a state machine. A state machine is an object that has a set number of
operating conditions that depend on the object’s previous condition to determine
output. As a result, individual states can make decisions based on their input,
perform actions, and pass output to other states.
Tasks do all of the work in your state machine. As you will learn in the next section, a
task can perform work by using an activity or an AWS Lambda function. Alternatively,
it can pass parameters to the API actions of other services. Each state machine starts
with an input. The state transforms the input and passes the output to the next state.
You can use the Step Functions console to visualize your state machine, and it
provides near-real-time information on your state machine tasks.
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 18
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
You define state machines by using the Amazon States Language (ASL). The Amazon
States Language is a JSON-based, structured language. Step Functions then
represents the JSON structure in a real-time graphical view so you can visualize your
state machine directly in the Step Functions console.
AWS Step Functions Workflow Studio is another way to define state machines. You
can use this low-code visual tool to build Step Functions through a guided, interactive
interface, so that you can prototype and build workflows faster.
For more information about AWS Step Functions Workflow Studio, see
https://docs.aws.amazon.com/step-functions/latest/dg/workflow-studio.html.
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 19
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
17
When a state machine is launched, the system begins with the state that is
referenced in the top-level StartAt field. After Step Functions runs a state, it uses the
value of the Next field to determine the next state to advance to. This step is called a
transition.
A terminal state is a Succeed state, a Fail state, or if the End field is set to true. When
the system reaches a terminal state or if a runtime error occurs, the state stops
running and returns a result.
For more information, see the following sections of the AWS Step Functions
Developer Guide:
• Transitions: https://docs.aws.amazon.com/step-functions/latest/dg/concepts-
transitions.html.
• Common State Fields: https://docs.aws.amazon.com/step-
functions/latest/dg/amazon-states-language-common-fields.html.
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 20
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
18
The following are the key takeaways from this section of the module:
• Step Functions is a service that you can use to coordinate components of
distributed applications and microservices by using visual workflows.
• A state machine is an object that has a set number of operating conditions that
depend on the object’s previous condition to determine output.
• State machines are defined by using the Amazon States Language.
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 21
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
19
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 22
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
State types
Task A single unit of work
Choice Adds branching logic to a state machine
Fail Stops running a state and marks it as a failure
Succeed Stops running a state successfully
Passes its input to its output, without performing
Pass
work
Wait Delays from continuing for a specified time
Parallel Creates parallel branches for running states
Map Dynamically iterates steps
20
In this section, you will learn about these different state types.
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 23
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
Task state
"ActivityState": {
"Type": "Task",
Amazon Elastic "Resource": "arn:aws:states:us-east-1:123456789012:activity:HelloWorld",
Compute Cloud "TimeoutSeconds": 300,
(Amazon EC2) "HeartbeatSeconds": 60,
"Next": "NextState"
}
Amazon Elastic
Container Service
(Amazon ECS)
"LambdaState": {
"Type": "Task",
Lambda "Resource": "arn:aws:lambda:us-east-1:123456789012:function:HelloWorld",
function "Next": "NextState"
}
21
Tasks do all of the work in your state machine. A task performs work by using an
activity or a Lambda function, or by passing parameters to the API actions of other
services. The Amazon States Language represents tasks by setting a state’s type to
Task (that is, "Type": "Task"). It also provides the task with the Amazon Resource
Name (ARN) of the activity or Lambda function.
An activity consists of program code that waits for an operator to perform an action
or to provide input. You can host activities on Amazon Elastic Compute Cloud
(Amazon EC2), Amazon Elastic Container Service (Amazon ECS), or even mobile
devices. Activities poll Step Functions by using the GetActivityTask, SendTaskSuccess,
SendTaskFailure, and SendTaskHeartbeat API actions.
Step Functions can invoke Lambda functions directly from a task state. Step Functions
also integrates with some AWS services, including the ability to directly call and pass
parameters to the API of those services. You can use Step Functions to coordinate
these services directly from the Amazon States Language.
The two examples show the Task state. The first example performs an activity that is
named HelloWorld (which is identified by the activity ARN in the Resource field). The
second example performs a Lambda function (which is identified by the Lambda
function ARN).
For more information about how Step Functions integrates with other AWS services,
see https://docs.aws.amazon.com/step-functions/latest/dg/concepts-
connectors.html.
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 24
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
Choice state
22
A Choice state ("Type": "Choice") adds branching logic to a state machine. A Choice
state must have a Choices field whose value is a non-empty array, and whose
element is an object called a Choice Rule.
In the example, the first choice rule checks whether the numerical value is equal to 1.
The second choice rule checks whether the numerical value is equal to 2.
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 25
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
"FailState": {
"Type": "Fail",
"Cause": "Invalid response.", Fail state
"Error": "ErrorA"
}
"SuccessState": {
"Type": "Succeed" Succeed state
}
23
A Fail state ("Type": "Fail") stops running the state machine and marks it as a failure.
The Fail state requires the Type field (which specifies the state’s type). In addition, the
Fail state offers the following optional fields:
• Cause: Provides a custom failure string that can be used for operational or
diagnostic purposes.
• Error: Provides an error name that can be used for error handling (retry/catch),
operational, or diagnostic purposes.
Because Fail states always exit the state machine, they have no Next field and they do
not require an End field. The slide provides examples of a Succeed state and a Fail
state.
A Succeed state ("Type": "Succeed") stops running a state successfully. The Succeed
state is a useful target for Choice state branches that don't do anything except stop
running the state. Because Succeed states are terminal states, they have no Next
field, and they don't need an End field.
For more information, see the following sections of the AWS Step Functions
Developer Guide:
• Succeed: https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-
language-succeed-state.html.
• Fail: https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-
language-fail-state.html.
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 26
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
Pass state
"No-op": {
Start
"Type": "Pass",
"Result": {
"x-datum": 0.381018,
"y-datum": 622.2269926397355 No-op
},
"ResultPath": "$.coords",
"Next": "End" End
}
24
A Pass state ("Type": "Pass") passes its input to its output, without performing
work. Pass states are useful when constructing and debugging state machines.
This example shows a state machine that consists of a single Pass state. When this
state machine runs, it injects some fixed data, which might be useful for testing
purposes.
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 27
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
Wait state
Start
"wait_ten_seconds": {
"Type": "Wait", StartState
"Seconds": 10,
"Next": "NextState"
} WaitState
FinalState
or
NextState
End
25
A Wait state ("Type": "Wait") delays the state machine from continuing for a specified
time. You can choose either a relative time (specified in seconds from when the state
begins), or an absolute end time (specified as a timestamp).
In this example, the Wait state introduces a 10-second delay into the state machine.
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 28
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
Parallel state
"LookupCustomerInfo": {
"Type": "Parallel", Start
"Branches": [
{
"StartAt": "PState1",
"States": { StartState
"PState1": {…}
}
},
{ Required PState1 PState2
"StartAt": "PState2",
"States": {
"PState2": {…}
FinalState
}
}
],
"Next": "NextState" End
}
26
The Parallel state ("Type": "Parallel") creates parallel branches running within your
state machine.
A Parallel state causes Step Functions to run each branch—starting with the state
named in that branch's StartAt field—as concurrently as possible. It will wait until all
branches reach a terminal state before it processes the Parallel state's Next field.
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 29
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
Map state
"Validate-All": {
"Type": "Map",
"InputPath": "$.detail", Iterator (required)
"ItemsPath": "$.shipped",
"MaxConcurrency": 0,
"Iterator": {
"StartAt": "Validate",
"States": {
"Validate": {
"Type": "Task",
"Resource": "arn:aws:lambda:us-east-1:123456789012:function:ship-val",
"End" : true
}
}
},
"ResultPath": "$.detail.shipped",
"End": true
}
27
The Map state ("Type": "Map") creates a set of steps that can be run for multiple
entries of an array.
By using a Map state, Step Functions can run the same steps for multiple entries of an
array in the state output. The Iterator field is required; this field’s value is a reference
path that identifies where in the effective input the array field is found. In this slide’s
example, the iterator is the "InputPath" field.
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 30
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
28
The following are the key takeaways from this section of the module:
• Individual states can make decisions based on their input, perform actions, and
pass and manipulate output to other states.
• Add branching logic to a state machine by adding a Choice state.
• Run multiple functions concurrently by using the Parallel state.
• Succeed and Fail states do not require an End field.
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 31
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
29
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 32
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
30
Step Functions has two types of workflow: Standard and Express. You define your
state machine by using the Amazon States Language regardless of which workflow
type you use. However, the state machine behavior when run will vary based on your
choice of Standard or Express workflows.
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 33
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
Standard workflows
• Ideal for long-running, auditable workflows
• Can run for up to 1 year
• Employ an exactly-once model
• Never run more than once unless the Retry
behavior is specified in ASL
• Are billed according to the number of
processed state transitions AWS Step
Functions
31
Standard workflows are ideal for long-running, auditable workflows, because they
show a history of previous runs, and provide visual debugging. The full run history can
be retrieved by using the Step Functions API for up to 90 days after your run has
completed. Standard workflows have an exactly-once workflow model, which means
that they never run more than once unless you have specified the Retry behavior in
ASL. Therefore, they are suitable for non-idempotent actions because their
invocations always result in a change of state.
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 34
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
Express workflows
• Ideal for high-volume, event-processing
workloads
• Can run for up to 5 minutes
• Employ an at-least-once (asynchronous) or
at-most-once (synchronous) model
• An invocation can run more than once
• Are billed according to number and duration AWS Express
of requests, and memory that is consumed Workflows
32
Express workflows are ideal for high-event-rate workloads, such as streaming data
processing and Internet of Things (IoT) data ingestion. Asynchronous Express
workflows have an at-least-once workflow model, and Synchronous Express
Workflows use an at-most-once workflow model. Express workflows can run for up to
5 minutes. They are billed based on the number of and duration of requests and
memory that is consumed.
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 35
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
These use cases can rely on Standard or Express workflows depending on their
requirements.
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 36
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
34
In Step Functions, activities are a way to associate code that runs somewhere (an
activity worker) with a specific task in a state machine. An activity worker can be an
application that runs on an EC2 instance, Lambda function, or mobile device. It can be
any application that can make an HTTP connection, which is hosted anywhere.
When Step Functions reaches an activity task state, the workflow waits for an activity
worker to poll for a task. An activity worker polls Step Functions by using the
GetActivityTask API action, and it sends the ARN for the related activity.
GetActivityTask returns a response, including input (a string of JSON input for the
task) and a taskToken (a unique identifier for the task). A task that is waiting for a
taskToken will wait until the invocation reaches the one-year service quota. It relies
on a Heartbeat threshold, which is specified in the state machine's ASL definition.
One common use case for activities is to manage a workflow that has a manual
approval step, such as a promotion approval. In this example, Amazon CloudWatch
invokes Lambda on a schedule. Lambda (the activity worker) polls Step Functions for
an activity task by calling GetActivityTask. First, Lambda successfully calls the API
action. Next, the activity is vended to Lambda as a string of JSON input for the task
and a taskToken for callback. Then, Lambda calls the Amazon Simple Email Service
(Amazon SES) messaging service. The messaging service sends an email notification
to a manager to either approve or deny an employee’s promotion. The response is
recorded as either a success (approve) or failure (deny) and is sent as an API request
to Amazon API Gateway. API Gateway calls either SendTaskSuccess or SendTaskFailure
and uses the vended token.
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 37
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
This example shows a serverless application. The code that fetches the work and acquires the token
is separate from the code that responds with the completion status and returns the token.
For more information, see the Implementing Serverless Manual Approval Steps in AWS Step
Functions and Amazon API Gateway blog post at
https://aws.amazon.com/blogs/compute/implementing-serverless-manual-approval-steps-in-aws-
step-functions-and-amazon-api-gateway/.
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 38
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
35
The JSON for the activity state machine for the manual approval process might look
like this code. In this example, the state type is "Task" and the activity ARN is
provided as a resource for the task.
For more information about how to integrate Step Functions with other AWS
services, see https://aws.amazon.com/step-functions/use-cases/.
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 39
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
36
This diagram depicts the flow of a Step Functions state machine that is used for
automated and continuous deployment of Amazon SageMaker models with Step
Functions. The dashed arrows that are highlighted in pink are instances where the
state machine must poll and wait for a task to be completed.
For more information, see the Automated and Continuous Deployment of Amazon
SageMaker Models with AWS Step Functions blog post at
https://aws.amazon.com/blogs/machine-learning/automated-and-continuous-
deployment-of-amazon-sagemaker-models-with-aws-step-functions/.
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 40
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
37
The following are the key takeaways from this section of the module:
• Activities are a Step Functions feature that associate code with a specific task in a
state machine.
• A taskToken is a token that represents a specific task that Step Functions generates
when a task is assigned to a worker.
• An activity worker can run on any application that is able to make an HTTP
connection.
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 41
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
38
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 42
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
You can access and use Step Functions by using the AWS Management Console, AWS
SDKs, or API.
You can run a Step Functions state machine by doing the following:
• Call the Step Functions StartExecution API action.
• Associate your Step Functions APIs with API operations in API Gateway. When an
HTTPS request is sent to an API operation, API Gateway invokes your Step
Functions API actions.
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 43
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
40
Step Functions places quotas, formerly referred to as limits, on the sizes of certain
state machine parameters. These parameters might include the number of API
actions you can make during a certain time period or how many state machines you
can define. Although these quotas are designed to prevent a misconfigured state
machine from consuming all of the resources of the system, they aren't hard quotas.
Quotas might differ significantly based on whether your state machine uses Standard
or Express workflows.
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 44
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
41
The following are the key takeaways from this section of the module:
• You can access Step Functions by using the console, AWS SDKs, or API.
• Step Functions places quotas on the size of certain state machine parameters.
• Use API Gateway to associate your Step Functions APIs with methods in an API
Gateway API.
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 45
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
Demonstration:
Creating Simple
Calculators by
Using Step
Functions
42
There is a video demonstration available for this topic. You can find this video within
the module 11 section of the course with the title: Demo Creating Simple Calculators
by Using Step Functions. If you are unable to locate this video demonstration please
reach out to your educator for assistance.
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 46
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
Lab 11.1:
Orchestrating
Serverless
Functions with
Step Functions
43
You will now complete Lab 11.1: Orchestrating Serverless Functions with Step
Functions.
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 47
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
Lab: Scenario
In this lab, you will build the functionality to create and deliver the
coffee inventory report using Step Functions.
44
In this lab, you will build functionality to create and deliver the coffee inventory
report using Step Functions.
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 48
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
Lab: Tasks
1. Preparing the development environment
2. Configuring an SNS topic and subscribing to it
3. Creating a Step Functions state machine
4. Creating a Lambda function to generate a presigned URL
5. Configuring the REST API to invoke the state machine
6. Configuring a Lambda function to generate an HTML report
7. Adding the GenerateHTML function to the state machine
8. Creating a Lambda function to retrieve supplier records
9. Adding the generateReportData function to the state machine
45
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 49
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
46
The diagram summarizes what you will have built after you complete the lab.
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 50
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
~ 90 minutes
47
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 51
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
Lab debrief:
Key takeaways
48
Your educator might choose to lead a conversation about the key takeaways from this
lab after you have completed it.
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 52
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
Module wrap-up
Module 11: Defining Workflows to Orchestrate Functions
49
It’s now time to review the module and wrap up with a knowledge check and
discussion of a practice certification exam question.
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 53
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
Module summary
In summary, in this module, you learned how to:
• Recognize the dynamics of workflow coordination in distributed applications
• Describe Step Functions
• Identify state types
• Indicate common use cases for Step Functions
• Recall Step Functions API operations
50
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 54
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
51
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 55
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
• Comparing
52
It is important to fully understand the scenario and question being asked before even
reading the answer choices. Find the keywords in this scenario and question that will
help you find the correct answer.
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 56
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
Choice Response
A Parallel
B Choice
C Task
D Pass
53
Now that we have bolded the keywords in this scenario, let us look at the answers.
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 57
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
Choice Response
A Parallel
B Choice
C Task
D Pass
54
Look at the answer choices and rule them out based on the keywords that were
previously highlighted.
Using a Choice state, you can have Step Functions make decisions based on the
Choice state’s input.
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 58
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
Additional resources
55
To learn more about the topics covered in this module, you might find the following
additional resources helpful:
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 59
AWS Training and Certification Module 11: Defining Workflows to Orchestrate Functions
Thank you
56
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 60