Slide 1

Slide 1 text

No content

Slide 2

Slide 2 text

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved. Understanding state and application workflows with AWS Step Functions Rob Sutter Sr. Developer Advocate AWS S V S 4 0 6

Slide 3

Slide 3 text

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved. • Amazon States Language improvements • The lifecycle of a single step • Handling errors • Parallelism and concurrency • Additional resources Agenda

Slide 4

Slide 4 text

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon States Language improvements

Slide 5

Slide 5 text

• Updates to Choice state • Global access to the context object • Dynamic timeouts • Result selector • String construction • JSON <-> string conversion • Array construction Amazon States Language improvements s12d.com/asl-improvements

Slide 6

Slide 6 text

• IsNull – null • IsString – string • IsNumeric – numeric • IsBoolean – Boolean • IsTimestamp – timestamp Choice state – Comparison operators s12d.com/asl-improvements

Slide 7

Slide 7 text

IsPresent Choice state – Existence test s12d.com/asl-improvements

Slide 8

Slide 8 text

StringMatches Choice state – Wildcarding s12d.com/asl-improvements

Slide 9

Slide 9 text

StringEqualsPath Choice state – Variable to variable comparison s12d.com/asl-improvements

Slide 10

Slide 10 text

Global access to the context object s12d.com/asl-improvements

Slide 11

Slide 11 text

Turning this . . .

Slide 12

Slide 12 text

. . . into this

Slide 13

Slide 13 text

• TimeoutSecondsPath • HeartbeatSecondsPath Dynamic timeouts s12d.com/asl-improvements

Slide 14

Slide 14 text

Result selector s12d.com/asl-improvements

Slide 15

Slide 15 text

Turning this . . .

Slide 16

Slide 16 text

Turning this . . .

Slide 17

Slide 17 text

. . . into this

Slide 18

Slide 18 text

String construction s12d.com/asl-improvements

Slide 19

Slide 19 text

JSON <-> string conversion • JsonToString • StringToJson s12d.com/asl-improvements

Slide 20

Slide 20 text

Array construction s12d.com/asl-improvements

Slide 21

Slide 21 text

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved. Step lifecycle

Slide 22

Slide 22 text

It all starts with an event . . .

Slide 23

Slide 23 text

. . . and some context

Slide 24

Slide 24 text

• InputPath • Task state • ResultSelector • ResultPath • OutputPath Order of operations Context ($$) State ($) Task InputPath ResultSelector OutputPath ResultPath $

Slide 25

Slide 25 text

“InputPath”: “$.InvokingEvent” Task InputPath ResultSelector OutputPath ResultPath

Slide 26

Slide 26 text

Task state Task InputPath ResultSelector OutputPath ResultPath

Slide 27

Slide 27 text

ResultSelector Task InputPath ResultSelector OutputPath ResultPath

Slide 28

Slide 28 text

“ResultPath”: “$.Detail.LockInfo” Task InputPath ResultSelector OutputPath ResultPath

Slide 29

Slide 29 text

“OutputPath”: “$.Detail” Task InputPath ResultSelector OutputPath ResultPath

Slide 30

Slide 30 text

Now state is transformed State ($) Task InputPath ResultSelector OutputPath ResultPath

Slide 31

Slide 31 text

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved. Handling errors

Slide 32

Slide 32 text

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved. “Complex systems run in degraded mode.” Richard I. Cook, MD MIT

Slide 33

Slide 33 text

• Task, Parallel, and Map states • Switch / case statement on ErrorEquals value • IntervalSeconds is the number of seconds before first retry • MaxAttempts is the number of retries (may be 0) • BackoffRate is a multiplier Retriers

Slide 34

Slide 34 text

• Task, Parallel, and Map states • Also known as fallback states • Scanned in array order when there is an error and no Retrier or all retries have failed • Switch / case statement on ErrorEquals value • ResultPath for storing error • Next defines the next state Catchers

Slide 35

Slide 35 text

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved. Parallelism and concurrency

Slide 36

Slide 36 text

• Parallel invocations • Dynamic parallelism (Map state) • Function-native concurrency Parallelism and concurrency s12d.com/sfn-pc

Slide 37

Slide 37 text

• Total items in ItemsPath limited by state limit of 256 KB • MaxConcurrency theoretically limitless if set to 0 (default) • Practically, host affinity limits concurrent invocations to 40 • MaxConcurrency synchronous and sequential when set to 1 Dynamic parallelism (Map state) s12d.com/sfn-pc

Slide 38

Slide 38 text

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved. • Amazon States Language improvements • The lifecycle of a single step • Handling errors • Parallelism and concurrency • Additional resources at s12d.com/svs406 Review

Slide 39

Slide 39 text

Thank you! © 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved. Rob Sutter Sr. Developer Advocate AWS Twitch: /robsutter Twitter: @rts_rob