Step Functions and AppSync Flashcards

1
Q

What are step functions?

A

Model your workflows as state machines
- Written in JSON

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the different states of the step function?

A

Choice - test for a condition to send to a branch
Fail or Succeed - Stop execution with failure or success
Pass - Simply pass input to its output or inject some fixed data without performing work
Wait - Provide a delay for a certain amount of time or until a point in time
Map - Dynamically iterate steps
Parallel - Begin parallel branches of execution

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What types of error handling can you have in a state machine, and in what order do they occur?

A

Retry (to retry a failed state) and Catch (transition to a failure path)
- Catch is triggered when the max attempts for Retry are reached

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How should you handle errors in the work flow?

A

Handle the errors inside the state machine, and not in the application code

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Why is it better to define error handling in the state machine?

A

Can define retry logic such as delay between retry, backoff retry rate and max attempts for each type of error without having to alter Lambda code (for example).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How can you configure the Catch state?

A

Indicate to Catch which is the next path you want to go to based on the ‘ErrorEquals’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How do you pass on information about a caught error to the next resource?

A

Declare “ResultPath”: “$.error” - this inserts error information into the input object, which is then passed to the next state.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How would you pause a Step Function during a Task to wait for a call to another service to return?

A

Wait for Task Token
- Append .waitForTaskToken to the Resource field when calling a resource to indicate to the step function is should wait until a Task Token is returned
- Task will pause until it receives the token back with a SendTaskSuccess or SendTaskFailure API call

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Describe the Activity Tasks flow

A

Task work is performed by an Activity Worker
- The Activity Worker apps can be running on EC2, Lambda, mobile etc.
- The Activity Worker polls for a Task using GetActivityTask API, and gets an input and TaskToken
- After work is complete, it sends a response of SendTaskSuccess or SendTaskFailure along with the output and TaskToken

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the difference between Activity Tasks and StepFunctions calling resources?

A

Activity Task is polling Step Function for a task; Step Function is calling SQS (for example) to complete a task (pull vs push)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How can you keep a Step Function task alive for extended periods of time (and what is the max)?

A

Configure a TimeoutSeconds to wait for up to a year
- Send a heartbeat from the Activity Worker using SendTaskHeartBeat within the time you set in HeartBeatSeconds

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are the main differences between standard and express step functions?

A

Standard:
- Max duration of 1 year
- Exactly once execution
- 2000/s executions
Express:
- Max duration of 5 minutes
- Over 100,000/s executions
- At-least-once (async) or at-most-once (sync) models

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are the main differences between standard and express step functions?

A

Standard:
- Max duration of 1 year
- Exactly once execution
- 2000/s executions
Express:
- Max duration of 5 minutes
- Over 100,000/s executions
- At-least-once (async) or at-most-once (sync) models

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What has replaced cognito sync, and what does it do?

A

AppSync - local data access and data synchronization

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What are the four ways to authorize applications to interact with AppSync GraphQL API?

A

API Key, IAM, OpenID Connect, CUP

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How can you allow a custom domain and HTTPS to interact with AppSync?

A

Use CloudFront in front of AppSync

17
Q

How does AppSync allow for real-time data?

A

With WebSocket or MQTT on WebSocket