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

Commit 238c594

Browse files
authored
add support for new regions and update instructions based on new SFN features and console changes (#98)
1 parent 67a60af commit 238c594

13 files changed

+33
-30
lines changed

ImageProcessing/README.md

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,19 @@ The following AWS CloudFormation template will create these resources:
7575
* **ThumbnailS3Bucket** stores the resized thumbnails of the rider photos
7676
* One Amazon DynamoDB table **RiderPhotoDDBTable** that stores the metadata of the rider's photo with rider's profile
7777
* AWS Lambda functions that performs the processing steps
78+
* IAM role **StateMachineRole** that gives the Step Functions state machine to invoke lambda functions
7879

7980

8081
Click on the link for the region you have chosen:
8182

82-
Region| Launch
83-
------|-----
84-
US East (N. Virginia) | [![Launch Module in us-east-1](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/images/cloudformation-launch-stack-button.png)](https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/new?stackName=wildrydes-step-module-resources&templateURL=https://s3.amazonaws.com/wild-rydes-step-module-us-east-1/0-cfn/wild-rydes-step-module-us-east-1.output.yaml)
85-
US West (Oregon) | [![Launch Module in us-west-2](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/images/cloudformation-launch-stack-button.png)](https://console.aws.amazon.com/cloudformation/home?region=us-west-2#/stacks/new?stackName=wildrydes-step-module-resources&templateURL=https://s3-us-west-2.amazonaws.com/wild-rydes-step-module-us-west-2/0-cfn/wild-rydes-step-module-us-west-2.output.yaml)
86-
EU (Ireland) | [![Launch Module 1 in eu-west-1](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/images/cloudformation-launch-stack-button.png)](https://console.aws.amazon.com/cloudformation/home?region=eu-west-1#/stacks/new?stackName=wildrydes-step-module-resources&templateURL=https://s3-eu-west-1.amazonaws.com/wild-rydes-step-module-eu-west-1/0-cfn/wild-rydes-step-module-eu-west-1.output.yaml)
83+
Region| Code | Launch
84+
------|------|-------
85+
US East (Ohio)| <span style="font-family:'Courier';">us-east-2</span> | [![Launch Module in us-east-2](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/images/cloudformation-launch-stack-button.png)](https://console.aws.amazon.com/cloudformation/home?region=us-east-2#/stacks/new?stackName=wildrydes-step-module-resources&templateURL=https://s3-us-east-2.amazonaws.com/wild-rydes-sfn-module-us-east-2/0-cfn/step2-sam.yaml)
86+
US East (N. Virginia) | <span style="font-family:'Courier';">us-east-1</span> | [![Launch Module in us-east-1](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/images/cloudformation-launch-stack-button.png)](https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/new?stackName=wildrydes-step-module-resources&templateURL=https://s3.amazonaws.com/wild-rydes-sfn-module-us-east-1/0-cfn/step2-sam.yaml)
87+
US West (Oregon) | <span style="font-family:'Courier';">us-west-2</span> | [![Launch Module in us-west-2](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/images/cloudformation-launch-stack-button.png)](https://console.aws.amazon.com/cloudformation/home?region=us-west-2#/stacks/new?stackName=wildrydes-step-module-resources&templateURL=https://s3-us-west-2.amazonaws.com/wild-rydes-sfn-module-us-west-2/0-cfn/step2-sam.yaml)
88+
EU (Ireland) | <span style="font-family:'Courier';">eu-west-1</span> | [![Launch Module in eu-west-1](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/images/cloudformation-launch-stack-button.png)](https://console.aws.amazon.com/cloudformation/home?region=eu-west-1#/stacks/new?stackName=wildrydes-step-module-resources&templateURL=https://s3-eu-west-1.amazonaws.com/wild-rydes-sfn-module-eu-west-1/0-cfn/step2-sam.yaml)
89+
Tokyo | <span style="font-family:'Courier';">ap-northeast-1</span> | [![Launch Module in ap-northeast-1](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/images/cloudformation-launch-stack-button.png)](https://console.aws.amazon.com/cloudformation/home?region=ap-northeast-1#/stacks/new?stackName=wildrydes-step-module-resources&templateURL=https://s3-ap-northeast-1.amazonaws.com/wild-rydes-sfn-module-ap-northeast-1/0-cfn/step2-sam.yaml)
90+
Sydney | <span style="font-family:'Courier';">ap-southeast-2</span> | [![Launch Module in ap-southeast-2](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/images/cloudformation-launch-stack-button.png)](https://console.aws.amazon.com/cloudformation/home?region=ap-southeast-2#/stacks/new?stackName=wildrydes-step-module-resources&templateURL=https://s3-ap-southeast-2.amazonaws.com/wild-rydes-sfn-module-ap-southeast-2/0-cfn/step2-sam.yaml)
8791

8892
<details>
8993
<summary><strong>AWS CloudFormation Launch Instructions (expand for details)</strong></summary><p>
@@ -108,6 +112,8 @@ EU (Ireland) | [![Launch Module 1 in eu-west-1](http://docs.aws.amazon.com/AWSCl
108112

109113
</p></details>
110114

115+
> You may copy & paste the contents of the **Outputs** tab of the CloudFormation stack to a separate text editor for ease of access later.
116+
111117

112118

113119
### 3. Create an initial AWS Step Functions state machine
@@ -179,21 +185,25 @@ Now you can create an AWS Step Functions state machine with the initial face det
179185

180186
1. You might see the Get Started page if you have not used AWS Step Functions before. If that's the case, click **Get Started**, it should lead you to the page to create a new state machine. Otherwise, click the **Create a State Machine** button.
181187

182-
1. Type `RiderPhotoProcessing-1` for the state machine name.
188+
189+
190+
1. Type `RiderPhotoProcessing` for the state machine name.
191+
192+
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.
193+
> 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`.
194+
195+
![select IAM role](./images/3-create-statemachine-select-role.png)
196+
183197

184198
1. Paste in the JSON from your `rider-photo-state-machine.json` file into the **Code** editor portion.
185199

186200
1. You can click on the &#x21ba; sign next to **Preview** to visualize the workflow:
187201

188-
![create initial state machine](./images/create-initial-state-machine-2.png)
202+
![create initial state machine](./images/3-initial-sfn-code.png)
189203

190204

191205
1. Click **Create State Machine** to create the state machine.
192206

193-
1. In the pop-up window, select the IAM role automatically generated for you (the name should look like `StatesExecutionRole-{region-name}`).
194-
195-
![pick IAM role for state machine](./images/pick-state-role.png)
196-
197207
1. Click the **New execution** button to start a new execution.
198208

199209
1. Here you specify the input data passed into the AWS Step Functions state machine to process.
@@ -330,11 +340,14 @@ If the uploaded photo has passed the basic face detection checks, the next step
330340
```
331341
</p></details>
332342

333-
1. Go back the AWS Step Functions Console, create a new state machine `RiderPhotoProcessing-2` by copy-pasting the updated JSON definition:
343+
1. Go back the AWS Step Functions Console, select the `RiderPhotoProcessing` state machine and click the **Edit state machine** button
344+
345+
![edit state machine](./images/4-edit-state-machine.png)
346+
347+
1. Copy-paste the updated JSON definition into the editor, then click **Update and start execution**
334348

335-
![Create State Machine with dedup step](./images/create-machine-with-dedup.png)
349+
![update state machine definition](./images/4-update-state-machine-definition.png)
336350

337-
> **Note**: AWS Step Functions state machines are immutable. Therefore, every time you want to change the state machine definition, you must always create a new state machine.
338351

339352
1. Test the new state machine with the test input you've used before:
340353

@@ -347,7 +360,6 @@ If the uploaded photo has passed the basic face detection checks, the next step
347360
```
348361
Because we haven't added the step yet to index the face in the photo into the Rekognition collection, the `CheckFaceDuplicate` step will always succeed at this point.
349362

350-
351363
</p></details>
352364

353365
### 5. Add parallel processing step
@@ -490,11 +502,10 @@ The ARNs of the two AWS Lambda functions that performs face index and generate t
490502
```
491503
</p></details>
492504

493-
1. Go back the AWS Step Functions Console, create a new state machine `RiderPhotoProcessing-3` by copy-pasting the updated JSON definition:
505+
1. Go back the AWS Step Functions Console, update the `RiderPhotoProcessing` statemachine by copy-pasting the updated JSON definition:
494506

495-
![Create State Machine with parallel step](./images/create-machine-with-parallel.png)
507+
![Update State Machine with parallel step](./images/5-update-state-machine-with-parallel-step.png)
496508

497-
> **Note**: AWS Step Functions state machines are immutable. Therefore, every time you want to change the state machine definition, you must always create a new state machine.
498509

499510
1. Test the new state machine with the test input you've used before:
500511

@@ -654,9 +665,10 @@ The ARN of the AWS Lambda function that persists the metadata can be found in th
654665
```
655666
</p></details>
656667

657-
1. Go back the AWS Step Functions Console, create a new state machine `RiderPhotoProcessing-4` by copy-pasting the updated JSON definition:
668+
1. Go back the AWS Step Functions Console, update the state machine by copy-pasting the updated JSON definition:
658669

659-
![Create state machine with persistence step](./images/create-machine-with-persistence.png)
670+
![Update state machine with persistence step](./images/6-update-state-machine-persistence.png)
671+
660672

661673
1. Test the new state machine with test input:
662674

@@ -725,16 +737,7 @@ The intent of the **PhotoDoesNotMeetRequirement** step is to send notification
725737

726738
## Clean-up
727739

728-
1. Delete the `RiderPhotoProcessing-*` state machines from the AWS Step Functions console.
729-
730-
<details>
731-
<summary><strong>Step-by-step instructions (expand for details)</strong></summary><p>
732-
733-
In the AWS Step Functions Management Console, go to **Dashboard**, select the state machine to delete, then click **Delete**.
734-
735-
![delete state machines](./images/delete-machines.png)
736-
737-
</p></details>
740+
1. Delete the `RiderPhotoProcessing` state machine from the AWS Step Functions console.
738741

739742
1. Empty the Amazon S3 buckets used to store rider images and thumbnails.
740743

85.8 KB
Loading
170 KB
Loading
40.5 KB
Loading
167 KB
Loading
154 KB
Loading
156 KB
Loading
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)