Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 3bcfb19

Browse files
authored
Merge pull request #10 from sliedig/sam-migration
AWS SAM build upgrade
2 parents 85ed5a8 + 083b255 commit 3bcfb19

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+2361
-1048
lines changed

‎.gitignore‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
# SPDX-License-Identifier: MIT-0
3+
14
.idea/
5+
.aws-sam/
6+
samconfig.toml
27
tmp
38
out.txt
49
packaged.yaml
@@ -35,3 +40,4 @@ packaged.yaml
3540
# End of https://www.gitignore.io/api/go,visualstudiocode
3641

3742

43+

‎LICENSE‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1+
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22

3-
Permission is hereby granted, free of charge, to any person obtaining a copy of this
4-
software and associated documentation files (the "Software"), to deal in the Software
5-
without restriction, including without limitation the rights to use, copy, modify,
6-
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
7-
permit persons to whom the Software is furnished to do so.
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of
4+
this software and associated documentation files (the "Software"), to deal in
5+
the Software without restriction, including without limitation the rights to
6+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7+
the Software, and to permit persons to whom the Software is furnished to do so.
88

9-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
10-
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
11-
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
12-
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
13-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
14-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
9+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
10+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
11+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
12+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
13+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
14+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

‎Makefile‎

Lines changed: 0 additions & 51 deletions
This file was deleted.

‎README.md‎

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,43 +6,54 @@ AWS Step Functions is a fully managed Serverless workflow management service for
66

77
When building cloud-based distributed architectures, one of the questions we need to ask ourselves is how do we maintain data consistency across microservices that have their own database / persistence mechanism? We do not have support for Distributed Transaction Coordinators (DTC) or two-phase commit protocols responsible for coordinating transactions across multiple cloud resources. We need a mechanism coordinate multiple local transactions.
88

9-
## What is the Saga Pattern?
9+
### What is the Saga pattern?
1010

1111
A Saga is a design pattern for dealing with "long-lived transactions" (LLT), published by Garcia-Molina and Salem in 1987. Their original paper can be found here [https://www.cs.cornell.edu/andru/cs711/2002fa/reading/sagas.pdf](https://www.cs.cornell.edu/andru/cs711/2002fa/reading/sagas.pdf).
1212

1313
> "LLT is a saga if it can be written as a sequence of transactions that can be interleaved with other transactions." (Garcia-Molina, Salem 1987)
1414
1515
Fundamentally it is a failure management pattern, that provides us the means to establish semantic consistency in our distributed applications by providing compensating transactions for every transaction where you have more than one collaborating services or functions.
1616

17-
## Why AWS Step Functions?
17+
### Why AWS Step Functions?
1818

1919
AWS Step Functions provide us with a mechanism for dealing with long-lived transactions, by providing us with the ability to build fully managed state machines that:
2020

2121
* coordinate the components of distributed applications and microservices
2222
* allowing us to build our state machines using visual workflows
2323
* provides us with a way to manage state and deal with failure
2424

25-
#Builder Session
25+
## Sample application
2626

27-
## Scenario
27+
### Scenario
2828

2929
You are creating an e-commerce application and are processing an order. This requires you to update order status, process a credit card transaction and update inventory levels. Each state integrates with a different backend with its own local transaction. You need to treat these as a single, distributed transaction.
3030

31-
![Saga with Step Functions](docs/images/stepdiagram2.png)
31+
![Saga with Step Functions](docs/images/stepdiagram_new.png)
3232

33-
## Learning Objectives
33+
### Learning objectives
3434

35-
In this Builder Session, we will:
35+
The goal is to demonstrate:
3636

37-
* Create a state machine that implements the Saga pattern
37+
* How to create a state machine that implements the Saga pattern
3838
* Understand how to use error handling and retry functionality using AWS Step Functions
3939
* Configure Task states to execute pre-provisioned AWS Lambda functions
4040

41-
## Get Started!
41+
### Get started
4242

4343
1. Read the [Setup Information](/docs/setup.md) to deploy the artefacts necessary to complete this session.
4444
1. Use the [Session Guide](/docs/guide.md) to assist you as you create your saga implementation for the e-commerce application scenario.
4545

46-
#License Summary
46+
## Additional Step Functions resources and reference architectures
4747

48-
This sample code is made available under a modified MIT license. See the [LICENSE](LICENSE) file.
48+
* [GitHub: AWS Step Function Samples](https://github.com/aws-samples/aws-stepfunctions-examples/)
49+
* [GitHub: AWS Step Functions Plagiarism Demo .NET Core](https://github.com/aws-samples/aws-step-functions-plagiarism-demo-dotnetcore)
50+
* [Documentation: AWS Step Functions Developer Guide](https://docs.aws.amazon.com/step-functions/latest/dg/welcome.html)
51+
* [Documentation: AWS Step Function Tutorials](https://docs.aws.amazon.com/step-functions/latest/dg/tutorials.html)
52+
* [Specification: Amazon States Language](https://states-language.net/spec.html)
53+
* [Tools: statelint](https://github.com/awslabs/statelint)
54+
55+
<hr/>
56+
57+
## License Summary
58+
59+
This sample code is made available under a modified MIT license. See the [LICENSE](LICENSE) file.

‎docs/guide.md‎

Lines changed: 32 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,39 @@ This is a sample template for Managing Long Lived Transactions with AWS Step Fun
66

77
``` bash
88
.
9-
├── Makefile <-- Make to automate build
10-
├── docs <-- Workshop guide and setup instructions
11-
│ ├── guide.md
12-
│ └── setup.md
13-
├── inventory
14-
│ ├── release <-- Lambda function code represents compensating transaction to release inventory
15-
│ └── reserve <-- Lambda function code represents task to reserve order items from the inventory
16-
├── models <-- Models package that defines the types used by the various functions and state data
9+
├── CODE_OF_CONDUCT.md
10+
├── CONTRIBUTING.md
11+
├── LICENSE
12+
├── README.md
13+
├── docs <-- # Workshop guide and setup instructions
14+
├── inventory-release <-- # Lambda function code represents compensating transaction to release inventory
15+
│ ├── ...
16+
│ └── main.go
17+
├── inventory-reserve <-- # Lambda function code represents compensating transaction to release inventory
18+
│ ├── ...
19+
│ └── main.go
20+
├── models <-- # Models package that defines the types used by the various functions and state data
21+
│ ├── ...
1722
│ ├── inventory.go
1823
│ ├── order.go
1924
│ └── payment.go
20-
├── order <-- Lambda function code represents task to create a new order and set status to "new order"
21-
│ ├── new
22-
│ └── update
23-
├── payment
24-
│ ├── pay <-- Lambda function code represents task to process financial transaction for the order
25-
│ └── refund <-- Lambda function code represents the compensating transaction to refund customer order
26-
├── state-machine.json <-- Sample saga implementation with Step Functions
27-
│ [USE THIS AS A GUIDE IF YOU GET STUCK]
28-
└── template.yaml <-- SAM template for defining and deploying serverless application resources
25+
├── order-new <-- # Lambda function code represents task to create a new order and set status to "new order"
26+
│ ├── ...
27+
│ └── main.go
28+
├── order-update <-- # Lambda function code represents compensating transaction for orders.
29+
│ ├── ... # Sets order status to "pending"
30+
│ └── main.go
31+
├── payment-credit <-- # Lambda function code represents the compensating transaction to refund customer order
32+
│ ├── ...
33+
│ └── main.go
34+
├── payment-debit <-- # Lambda function code represents task to process financial transaction for the order
35+
│ ├── ...
36+
│ └── main.go
37+
├── statemachine
38+
│ └── llt.asl.yaml <-- # Step Functions ASL template
39+
├── template.yaml <-- # AWS SAM template for defining and deploying serverless application resources
40+
└── ...
41+
2942
```
3043

3144
## Amazon States Language
@@ -123,16 +136,8 @@ aws stepfunctions start-execution \
123136
--region [AWS_REGION]
124137
```
125138

126-
[DOWNLOAD SCENARIO CLI COMMANDS](cli-commands.txt)
127-
128-
## Additional Step Functions Resources
129-
130-
* [AWS Step Functions](https://aws.amazon.com/step-functions/)
131-
* [AWS Step Functions Developer Guide](https://docs.aws.amazon.com/step-functions/latest/dg/welcome.html)
132-
* [AWS Step Function Tutorials](https://docs.aws.amazon.com/step-functions/latest/dg/tutorials.html)
133-
* [statelint](https://github.com/awslabs/statelint)
134-
* [Amazon States Language](https://states-language.net/spec.html)
139+
**[DOWNLOAD SCENARIO CLI COMMANDS](cli-commands.txt)**
135140

136141
## How else can you implement this solution?
137142

138-
Is there any other way you can think of how to break this problem down? What other features of Step Functions could be employed to implement a saga pattern?
143+
Is there any other way you can think of how to break this problem down? What other features of Step Functions could be employed to implement a saga pattern?

‎docs/images/capabilities.png‎

-10.7 KB
Loading[フレーム]

‎docs/images/cfn-output.png‎

-19 KB
Loading[フレーム]

‎docs/images/path.png‎

-125 KB
Binary file not shown.

‎docs/images/path_happy.png‎

-41.9 KB
Binary file not shown.

‎docs/images/paths-breakdown-1.png‎

7.33 KB
Loading[フレーム]

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /