Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

Commit 978a63d

Browse files
timothy-bakermikedeck
authored andcommitted
update step 3 for new step functions UI
1 parent 058639e commit 978a63d

File tree

6 files changed

+20
-17
lines changed

6 files changed

+20
-17
lines changed

ImageProcessing/README.md

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ When users upload the photo of themselves, a few steps of verification and proce
1717
1. Index the user's face into the collection so it can be used for matching in the future.
1818
1. Store the photo metadata with the user's profile.
1919

20-
In the serverless world, each of steps above can be easily implemented with a AWS Lambda function. But how can we manage the flow of invoking one Lambda function after the previous step has finished and keep track of what happened with each image? What if one of the Lambda function times out and needs to be retried? Some of the Lambda functions can be run in parallel to reduce end-to-end processing latency, how can we coordinate running Lambda functions in parallel and wait for them to finish? AWS Step Functions makes it very easy to solve these problems and provides an audit trail and visualization to track what happened with each flow.
20+
In the serverless world, each of steps above can be easily implemented with a AWS Lambda function. But how can we manage the flow of invoking one Lambda function after the previous step has finished and keep track of what happened with each image? What if one of the Lambda function times out and needs to be retried? Some of the Lambda functions can be run in parallel to reduce end-to-end processing latency, how can we coordinate running Lambda functions in parallel and wait for them to finish? AWS Step Functions makes it very easy to solve these problems and provides an audit trail and visualization to track what happened with each flow.
21+
2122
## Architecture Overview
2223
The architecture for this module is composed of several AWS Lambda functions that leverage the facial detection capabilities of **Amazon Rekognition**, resize the uploaded image stored in **Amazon S3**, and save the image metadata with the user profile using **Amazon DynamoDB**. The orchestration of these Lambda functions is managed by an **AWS Step Functions** state machine.
2324

@@ -27,7 +28,8 @@ Below is the flow diagram of the workflow we will build as visualized by **AWS
2728

2829
<img src="./images/4th-state-machine-graph.png" width="60%">
2930

30-
In this module, we will manually kick-off processing workflows from the AWS Step Functions management console. In a real world application, you can configure an Amazon API Gateway that your application invokes to trigger the Step Functions state machine, or have it triggered by an Amazon S3 upload event through Amazon CloudWatch Events or S3 event notifications.
31+
In this module, we will manually kick-off processing workflows from the AWS Step Functions management console. In a real world application, you can configure an Amazon API Gateway that your application invokes to trigger the Step Functions state machine, or have it triggered by an Amazon S3 upload event through Amazon CloudWatch Events or S3 event notifications.
32+
3133
## Implementation Instructions
3234

3335
Each of the following sections provide an implementation overview and detailed, step-by-step instructions. The overview should provide enough context for you to complete the implementation if you're already familiar with the AWS Management Console or you want to explore the services yourself without following a walkthrough.
@@ -69,8 +71,10 @@ Using the AWS Command Line Interface, create a collection in the Amazon Rekognit
6971

7072
### 2. Deploy Amazon S3, AWS Lambda and Amazon DynamoDB resources using AWS CloudFormation
7173

72-
The following AWS CloudFormation template will create these resources:
73-
* Two Amazon S3 buckets: * **RiderPhotoS3Bucket** stores the photos uploaded by the riders
74+
The following AWS CloudFormation template will create these resources:
75+
76+
* Two Amazon S3 buckets:
77+
* **RiderPhotoS3Bucket** stores the photos uploaded by the riders
7478
* A few test images will be copied into the **RiderPhotoS3Bucket** bucket
7579
* **ThumbnailS3Bucket** stores the resized thumbnails of the rider photos
7680
* One Amazon DynamoDB table **RiderPhotoDDBTable** that stores the metadata of the rider's photo with rider's profile
@@ -118,7 +122,7 @@ Asia Pacific (Sydney) | <span style="font-family:'Courier';">ap-southeast-2</spa
118122
119123

120124

121-
### 3. Create an initial AWS Step Functions state machine
125+
### 3. Create an initial AWS Step Functions state machine
122126

123127
After the riders upload their photo, the first thing we need do in our processing pipeline is to run a face detection algorithm on it to verify that it has a recognizable face in the photo (zero or multiple faces in the photo doesn't help unicorns recognize the rider) and the face is not wearing sunglasses (makes it harder to identify the rider). If these validations fail, notify the user and end the workflow.
124128

@@ -191,34 +195,33 @@ Now you can create an AWS Step Functions state machine with the initial face det
191195

192196
1. Type `RiderPhotoProcessing` for the state machine name.
193197

194-
1. For **IAM role for your state machine executions**, pick **I will use an existing role**, and select the IAM role created by the CloudFormation in the previous step.
195-
> The name of the IAM role should have the prefix `wildrydes-step-modules-resources` (the name of the CloudFormation stack) To verify the IAM role's full name, you can open a new tab for the CloudFormation console and check the **Output** section of the stack you just created, and look for `StateMachineRole`.
196-
197-
![select IAM role](./images/3-create-statemachine-select-role.png)
198-
198+
1. Paste in the JSON from your `rider-photo-state-machine.json` file into the **Code** editor portion.
199199

200-
1. Paste in the JSON from your `rider-photo-state-machine.json` file into the **Code** editor portion.
201-
202-
1. You can click on the &#x21ba; sign next to **Preview** to visualize the workflow:
200+
1. You can click on the &#x21ba; sign in the preview panel to visualize the workflow:
203201

204202
![create initial state machine](./images/3-initial-sfn-code.png)
205203

204+
1. Click **Next**.
205+
206+
1. For **IAM role for executions**, pick **Choose an existing role**, and select the IAM role created by the CloudFormation in the previous step.
207+
> The name of the IAM role should have the prefix `wildrydes-step-modules-resources` (the name of the CloudFormation stack) To verify the IAM role's full name, you can open a new tab for the CloudFormation console and check the **Output** section of the stack you just created, and look for `StateMachineRole`.
208+
209+
![select IAM role](./images/3-create-statemachine-select-role.png)
206210

207211
1. Click **Create State Machine** to create the state machine.
208212

209-
1. Click the **New execution** button to start a new execution.
213+
1. Click the **Start execution** button to start a new execution.
210214

211215
1. Here you specify the input data passed into the AWS Step Functions state machine to process.
212216

213217
Each execution of a Step Functions state machine has an unique ID. You can either specify one when starting the execution, or have the service generate one for you. In the text field that says "enter your execution id here", you can specify an execution ID, or leave it blank.
214218

215219
For the input data, type in the follow JSON. Make sure to substitute the `s3Bucket` field with your own values.
216220

217-
For `s3Bucket` field, look in the **Outputs** section of the `wildrydes-step-module-resources` stack for `RiderPhotoS3Bucket`.
221+
For `s3Bucket` field, look in the **Outputs** section of the `wildrydes-step-module-resources` stack for `RiderPhotoS3Bucket`.
218222

219-
The `userId` field is needed because in later processing steps, the userId is used to record which user the profile picture is associated with.
223+
The `userId` field is needed because in later processing steps, the userId is used to record which user the profile picture is associated with.
220224

221-
222225
```JSON
223226
{
224227
"userId": "user_a",
-85.7 KB
Loading
5.32 KB
Loading
-23.6 KB
Loading
92.8 KB
Loading
474 Bytes
Loading

0 commit comments

Comments
 (0)