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

Commit 3526172

Browse files
author
Gregory Davis
committed
Added suggested tweaks to the triggering and testing section, and fixed step number ordering.
1 parent 0e870ce commit 3526172

File tree

4 files changed

+29
-19
lines changed

4 files changed

+29
-19
lines changed

ImageProcessing/workshop/content/04_validation/20_triggering/_index2.en.md

+29-19
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,14 @@ Click **Save conditions**. When you return back to the Workflow Studio view, set
125125
alt="Step 9"
126126
>}}
127127
128-
➡️ Step 10: On the **Input** tab for the **Pass State**, check the `Transform input with Parameters` option, and paste the following in the text box.
128+
➡️ Step 10: On the **Configuration** tab for the **Pass State**, Change the **State name** value to `TransformS3event`.
129+
130+
{{< figure
131+
src="/images/triggering-step10a.png"
132+
alt="Step 10"
133+
>}}
134+
135+
➡️ Step 11: On the **Input** tab for the **Pass State**, check the `Transform input with Parameters` option, and paste the following in the text box.
129136

130137
{{< highlight json >}}
131138
{
@@ -136,27 +143,30 @@ Click **Save conditions**. When you return back to the Workflow Studio view, set
136143

137144
{{< figure
138145
src="/images/triggering-step10.png"
139-
alt="Step 10"
146+
alt="Step 11"
140147
>}}
141148
142149
{{% notice info %}}
143150
Note that you don't have to modify the values of the JSON above. It will dynamically pick the values out of the EventBridge event and place them in the correct values for the input event expected by the Lambda function. One caveat is that the userId is now tied to the AWS Account Id that is uploading the image. When we test this later, you'll find that you can only trigger the Step Function state machine once this way unless you remove the face index from the Rekognition collection associated with your AWS Account Id after every S3 upload.
144151
{{% /notice %}}
145152

153+
{{% notice tip%}}
154+
Before moving on, let's consider what we've done here. With no change to any of the Lambda functions, we've created a way to successfully reuse our workflow in response to different triggering event sources. This simplifies worklflow management by not requiring a different state machine for different event sources and allows testable and transparent changes to accommodate additional triggering events that may arise in the future. Take some time to consider how this functionality might be useful for simple data transformations in general.
155+
{{% /notice %}}
146156

147-
➡️ Step 11: Click **Apply and exit** in the top right of the window to apply all changes and return to the state machine definition page.
157+
➡️ Step 12: Click **Apply and exit** in the top right of the window to apply all changes and return to the state machine definition page.
148158

149159
{{< figure
150160
src="/images/statemachine-step11.png"
151-
alt="Step 10"
161+
alt="Step 12"
152162
>}}
153163
154164
To save the changes you made, you must also click the **Save** button in the top right of the state machine definition page.
155165

156166

157167
{{< figure
158168
src="/images/statemachine-step11b.png"
159-
alt="Step 10"
169+
alt="Step 12"
160170
>}}
161171
162172
{{% notice warning %}}
@@ -167,67 +177,67 @@ You may get an alert dialog when saving informing you that your changes may affe
167177

168178
{{< figure
169179
src="/images/statemachine-step11c.png"
170-
alt="Step 10"
180+
alt="Step 12"
171181
>}}
172182
173183
At this point, your saved state machine should look similar to the following:
174184

175185
{{< figure
176186
src="/images/triggering-step10b.png"
177-
alt="Step 10b"
187+
alt="Step 12b"
178188
>}}
179189
180190
### Test the trigger
181191

182192
Now we can test the S3 upload event trigger. First, find a picture that we've not previously used (you can use any .png or .jpg, but try to use one with a single person with a clear view of thier face). Then, let's upload it to S3.
183193

184-
➡️ Step 11: From the AWS Management Console, type "S3" in the search field at the top of the window and select **s3** from the list of services.
194+
➡️ Step 13: From the AWS Management Console, type "S3" in the search field at the top of the window and select **s3** from the list of services.
185195

186196
{{< figure
187197
src="/images/triggering-step11.png"
188-
alt="Step 11"
198+
alt="Step 13"
189199
>}}
190200
191-
➡️ Step 12: In the list of buckets, click the bucket beginning with `wildrydes-step-module-resource-riderphotos3bucket-`. You should see four objects in that bucket corresponding to the images that we pre-populated from the CloudFormation template.
201+
➡️ Step 14: In the list of buckets, click the bucket beginning with `wildrydes-step-module-resource-riderphotos3bucket-`. You should see four objects in that bucket corresponding to the images that we pre-populated from the CloudFormation template.
192202

193203
{{< figure
194204
src="/images/triggering-step12.png"
195-
alt="Step 12"
205+
alt="Step 14"
196206
>}}
197207
198208
Click the **Upload** button. Then drag and drop an image file onto the browser window to add it to the list of files to be uploaded. In this example, you can see a file named `baby.jpg` was added. Then click **Upload**.
199209

200210
{{< figure
201211
src="/images/triggering-step12b.png"
202-
alt="Step 12b"
212+
alt="Step 14b"
203213
>}}
204214
205215
If your upload was successful, you should see a notification like the following:
206216

207217
{{< figure
208218
src="/images/triggering-step12c.png"
209-
alt="Step 12c"
219+
alt="Step 14c"
210220
>}}
211221
212-
➡️ Step 13: From the AWS Management Console, type "Step Functions" in the search field at the top of the window and select **Step Functions** from the list of services.
222+
➡️ Step 15: From the AWS Management Console, type "Step Functions" in the search field at the top of the window and select **Step Functions** from the list of services.
213223

214224
{{< figure
215225
src="/images/statemachine-step1.png"
216-
alt="Step 13"
226+
alt="Step 15"
217227
>}}
218228
219-
➡️ Step 14: Click the link for your state machine named **RiderPhotoProcessing**.
229+
➡️ Step 16: Click the link for your state machine named **RiderPhotoProcessing**.
220230

221231
{{< figure
222232
src="/images/triggering-step13.png"
223-
alt="Step 14"
233+
alt="Step 16"
224234
>}}
225235
226-
➡️ Step 15: Check the **Executions** section to see that the a new execution is running (or just finished).
236+
➡️ Step 17: Check the **Executions** section to see that the a new execution is running (or just finished).
227237

228238
{{< figure
229239
src="/images/triggering-step15.png"
230-
alt="Step 15"
240+
alt="Step 17"
231241
>}}
232242
233243
:white_check_mark: Congratulations! You have now triggered your state machine to execute using an S3 event. You can continue to test this functionality (but remember to remove your indexed face from the Rekognition collection after each execution) by repeating the process above. You can also dig deeper to examine the results of the execution. For example, what happens if you upload two pictures?
Loading
Loading
Loading

0 commit comments

Comments
 (0)