AWS Cloud Developer Associate Certification

Other server-less- step-function and AppSync


Step Functions Overview

  1. Model your workflows as state machines (one per workflow)
    1. Order fulfillment, Data processing
    2. Web applications, Any workflow
  2. Written in JSON
  3. Visualization of the workflow and the execution of the workflow, as well as history.
  4. Start workflow with SDK call, API Gateway, Event Bridge (CloudWatch Event)


Step Function – Task States

  1. Do some work in your state machine
  2. Invoke one AWS service
    1. Can invoke a Lambda function
    2. • Run an AWS Batch job
    3. • Run an ECS task and wait for it to complete
    4. • Insert an item from DynamoDB
    5. • Publish message to SNS, SQS
    6. • Launch another Step Function workflow
  3. Run an one Activity
    1. EC2, Amazon ECS, on-premises
    2. • Activities poll the Step functions for work
    3. • Activities send results back to Step Functions
Example – Invoke Lambda Function

Step Function – States

  1. Choice State – Test for a condition to send to a branch (or default branch)
  2. Fail or Succeed State – Stop execution with failure or success
  3. Pass State – Simply pass its input to its output or inject some fixed data. without performing work.
  4. Wait State – Provide a delay for a certain amount of time or until a specified time/date.
  5. Map State – Dynamically iterate steps.’
  6. Parallel State – Begin parallel branches of execution

Step Functions – Error Handling

  1. Any state can encounter runtime errors for various reasons
    1. State machine definition issues (for example, no matching rule in a Choice state)
    2. Task failures (for example, an exception in a Lambda function)
    3. Transient issues (for example, network partition events)
  2. Use Retry (to retry failed state) and Catch (transition to failure path) in the State Machine to handle the errors instead of inside the Application Code
  3. Predefined error codes:
    1. States.ALL : matches any error name
    2. States.Timeout: Task ran longer than TimeoutSeconds or no heartbeat received
    3. States.TaskFailed: execution failure
    4. States.Permissions: insufficient privileges to execute code
  4. The state may report is own errors

Step Functions – Retry (Task or Parallel State)

  1. Evaluated from top to bottom
  2. ErrorEquals: match a specific kind of error
  3. IntervalSeconds: initial delay before retrying
  4. BackoffRate: multiple the delay after each retry
  5. MaxAttempts: default to 3, set to 0 for never retried
  6. When max attempts are reached, the Catch kicks in
Step Functions – Retry (Task or Parallel State)

Step Functions – Catch (Task or Parallel State)

  1. Evaluated from top to bottom
  2. ErrorEquals: match a specific kind of error
  3. Next: State to send to
  4. ResultPath – A path that determines what input is sent to the state specified in the Next field.

Step Function – ResultPath

  1. Include the error in the input

Step Functions – Standard vs Express

Standard WorkflowsExpress Workflows
Maximum duration1 year.5 minutes.
Supported execution start rateOver 2,000 per secondOver 100,000 per second
Supported state transition rateOver 4,000 per second per accountNearly unlimited
PricingPriced per state transition. A state transition is
counted each time a step in your execution is
completed (more expensive)
Priced by the number of executions you run,
their duration, and memory consumption
(cheaper)
Execution historyExecutions can be listed and described with Step
Functions APIs, and visually debugged through
the console. They can also be inspected in
CloudWatch Logs by enabling logging on your
state machine.
Executions can be inspected in CloudWatch
Logs by enabling logging on your state
machine.
Execution semanticsExactly-once workflow executionAt-least-once workflow execution

AppSync Overview

  1. AppSync is a managed service that uses GraphQL
  2. GraphQL makes it easy for applications to get exactly the data they need
  3. This includes combining data from one or more sources
    1. NoSQL data stores, Relational databases, HTTP APIs…
    2. Integrates with DynamoDB, Aurora, Elasticsearch & others
    3. Custom sources with AWS Lambda
  4. Retrieve data in real-time with WebSocket or MQTT on WebSocket
  5. For mobile apps: local data access & data synchronization
  6. It all starts with uploading one GraphQL schema

AppSync – Security

  1. There are four ways you can authorize applications to interact with your AWS AppSync GraphQL API:
    1. API_KEY
    2. AWS_IAM: IAM users / roles / cross-account access
    3. OPENID_CONNECT: OpenID Connect provider / JSON Web Token
    4. AMAZON_COGNITO_USER_POOLS
  2. For custom domain & HTTPS, use CloudFront in front of AppSync

Published by

Unknown's avatar

sevanand yadav

software engineer working as web developer having specialization in spring MVC with mysql,hibernate

Leave a comment