You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 14, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: ImageProcessing/workshop/content/04_validation/20_triggering/_index2.en.md
+29-19
Original file line number
Diff line number
Diff line change
@@ -125,7 +125,14 @@ Click **Save conditions**. When you return back to the Workflow Studio view, set
125
125
alt="Step 9"
126
126
>}}
127
127
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.
129
136
130
137
{{< highlight json >}}
131
138
{
@@ -136,27 +143,30 @@ Click **Save conditions**. When you return back to the Workflow Studio view, set
136
143
137
144
{{< figure
138
145
src="/images/triggering-step10.png"
139
-
alt="Step 10"
146
+
alt="Step 11"
140
147
>}}
141
148
142
149
{{% notice info %}}
143
150
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.
144
151
{{% /notice %}}
145
152
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 %}}
146
156
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.
148
158
149
159
{{< figure
150
160
src="/images/statemachine-step11.png"
151
-
alt="Step 10"
161
+
alt="Step 12"
152
162
>}}
153
163
154
164
To save the changes you made, you must also click the **Save** button in the top right of the state machine definition page.
155
165
156
166
157
167
{{< figure
158
168
src="/images/statemachine-step11b.png"
159
-
alt="Step 10"
169
+
alt="Step 12"
160
170
>}}
161
171
162
172
{{% notice warning %}}
@@ -167,67 +177,67 @@ You may get an alert dialog when saving informing you that your changes may affe
167
177
168
178
{{< figure
169
179
src="/images/statemachine-step11c.png"
170
-
alt="Step 10"
180
+
alt="Step 12"
171
181
>}}
172
182
173
183
At this point, your saved state machine should look similar to the following:
174
184
175
185
{{< figure
176
186
src="/images/triggering-step10b.png"
177
-
alt="Step 10b"
187
+
alt="Step 12b"
178
188
>}}
179
189
180
190
### Test the trigger
181
191
182
192
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.
183
193
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.
185
195
186
196
{{< figure
187
197
src="/images/triggering-step11.png"
188
-
alt="Step 11"
198
+
alt="Step 13"
189
199
>}}
190
200
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.
192
202
193
203
{{< figure
194
204
src="/images/triggering-step12.png"
195
-
alt="Step 12"
205
+
alt="Step 14"
196
206
>}}
197
207
198
208
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**.
199
209
200
210
{{< figure
201
211
src="/images/triggering-step12b.png"
202
-
alt="Step 12b"
212
+
alt="Step 14b"
203
213
>}}
204
214
205
215
If your upload was successful, you should see a notification like the following:
206
216
207
217
{{< figure
208
218
src="/images/triggering-step12c.png"
209
-
alt="Step 12c"
219
+
alt="Step 14c"
210
220
>}}
211
221
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.
213
223
214
224
{{< figure
215
225
src="/images/statemachine-step1.png"
216
-
alt="Step 13"
226
+
alt="Step 15"
217
227
>}}
218
228
219
-
➡️ Step 14: Click the link for your state machine named **RiderPhotoProcessing**.
229
+
➡️ Step 16: Click the link for your state machine named **RiderPhotoProcessing**.
220
230
221
231
{{< figure
222
232
src="/images/triggering-step13.png"
223
-
alt="Step 14"
233
+
alt="Step 16"
224
234
>}}
225
235
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).
227
237
228
238
{{< figure
229
239
src="/images/triggering-step15.png"
230
-
alt="Step 15"
240
+
alt="Step 17"
231
241
>}}
232
242
233
243
: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?
0 commit comments