Giter Site home page Giter Site logo

aws-samples / aws-step-functions-plagiarism-demo-dotnetcore Goto Github PK

View Code? Open in Web Editor NEW
66.0 6.0 24.0 5.89 MB

A simple workflow for developing AWS Step Functions to demonstrate how you can combine AWS Step Functions with AWS Lambda using .NET 6 and the Serverless Application Model (SAM), and expose your workflow via an API Gateway!

License: MIT No Attribution

C# 65.81% JavaScript 1.18% HTML 10.05% Shell 0.35% Vue 20.45% SCSS 2.16%
aws aws-step-functions dotnetcore aws-serverless aws-sam-cli csharp aws-lambda

aws-step-functions-plagiarism-demo-dotnetcore's Introduction

AWS Step Functions Plagiarism Demo .NET

Welcome! This a simple workflow to demonstrate how you can combine AWS Step Functions with AWS Lambda, Amazon DynamoDB, AWS XRay, using Microsoft .NET Core.

Along the way we provide an example of how to integrate Amazon API Gateway with AWS Step Functions, and use the AWS Step Function Service Integration Callback Pattern, to interface with an external website from a manual process in the workflow.

You will also see how we use the AWS Serverless Application Model (SAM) to define and model your Serverless application, and use AWS SAM CLI to build and deploy it.

The Scenario

To illustrate the use of AWS Step Functions I have created a scenario that describes a process where university students caught plagiarising on exams and/or assignments are required to take a test to assess their knowledge of the universities referencing standards.

Visually, the process looks like this:

Developing With Step Functions

The process starts by:

  1. Registering the plagiarism incident
  2. Scheduling an exam. Students have one week to complete the test.
  3. Send the student an email notification to inform them of the requirement
  4. The process waits for the student to complete the exam, then
  5. Determining whether or not the student has sat the exam, or passed

If the student has fails the exam they are allowed to resit the exam. Students get 3 attempts to pass the exam before the incident is either resolved, or administrative action is taken.

The Architecture

Developing With Step Functions Architecture

The architecture is relatively simple. There are two front end websites - one "Admin" website that capture the plagiarism incident; and a "Testing Centre" that tests the students knowledge of plagiarism.

The incident captured at via the Admin website initiates the AWS Step Function execution through an AWS Service integration on the /incident resource for the POST method.

Integration Request

Once the the exam is scheduled, we use an AWS Lambda service integration Task with a .waitForTaskToken (see AWS docs). The Task Token is passed to the function which in turn generates the email which is sent to the student, notifying them of the exam requirements.

"SendNotification": {
    "Type": "Task",
    "Comment": "Send email confirming exam details and exam deadline. Wait for callback.",
    "Resource": "arn:aws:states:::lambda:invoke.waitForTaskToken",
    "Parameters":{
    "FunctionName":"${SendExamNotificationFunction}",
    "Payload":{
        "input.$":"$",
        "TaskToken.$":"$$.Task.Token"
    }
    },
    "Next": "HasStudentPassedExam"
},

Once the student receives the email, the Task Token is passed to the Testing Centre. The student answers the questions and submits the results to the /exam resource on the API. The Lambda integration processes the TaskToken and passes the results of the waiting execution to continue the workflow execution.

Resources

Step Functions

References

AWS Developer Resources

License Summary

This sample code is made available under a modified MIT license. See the LICENSE file.

aws-step-functions-plagiarism-demo-dotnetcore's People

Contributors

cam8001 avatar dependabot[bot] avatar sliedig avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

aws-step-functions-plagiarism-demo-dotnetcore's Issues

SAM Local Development: No APIs connected to Lambda functions

I'm following the readme located in ./AWSStepFunctionsPlagiarismDemo/README.md. I'm trying to build and run the project on my local environment to get a feel of how step functions and lambdas work together. It's my understanding that SAM CLI should allow to run this entire project entirely on my machine without deploying anything to AWS. I'm very new to AWS and SAM CLI so it might be
something basic.

When I try to run the environment locally on my machine, I get the error:

Error: Template does not have any APIs connected to Lambda functions

Please see details below.

OS: Windows 10 Pro

Steps to Reproduce

  1. git clone project
  2. cd \aws-step-functions-plagiarism-demo-dotnetcore\AWSStepFunctionsPlagiarismDemo
  3. Issue build command. All projects built, tested, published, and packed successfully:

Partial Output:

PS> ./build.ps1 --target=Package
...
...
========================================         
Pack                                             
========================================         
Packing 'AdminActionTask'...                     
'AdminActionTask' has been packed.               
Packing 'RegisterIncidentTask'...                
'RegisterIncidentTask' has been packed.          
Packing 'ResolveIncidentTask'...                 
'ResolveIncidentTask' has been packed.           
Packing 'ScheduleExamTask'...                    
'ScheduleExamTask' has been packed.              
Packing 'SendNotificationTask'...                
'SendNotificationTask' has been packed.          
Packing 'ValidateExamTask'...                    
'ValidateExamTask' has been packed.              
                                                 
========================================         
Package                                          
========================================         
Package target ran.                              
                                                 
----------------------------------------         
Teardown                                         
----------------------------------------         
Finished running tasks.                          
                                                 
Task                          Duration           
-------------------------------------------------
Setup                         00:00:00.0092101   
Clean                         00:00:00.0626336   
Restore                       00:00:07.6779663   
Build                         00:00:05.9309569   
Test-Unit                     00:00:00.0057104   
Publish                       00:00:11.1256509   
Pack                          00:00:05.9838550   
Package                       00:00:00.0025241   
Teardown                      00:00:00.0022985   
-------------------------------------------------
Total:                        00:00:30.8008058   
  1. Issue SAM command for local development: sam local start-api

Output:

> sam local start-api
2019-02-14 09:58:44 Found credentials in shared credentials file: ~/.aws/credentials
Error: Template does not have any APIs connected to Lambda functions

Fix automated Github security vulnerabilities

minimist high severity
src/frontend/testcentre/yarn.lock

acorn - moderate severity
src/frontend/testcentre/yarn.lock

kind-of - moderate severity
src/frontend/testcentre/yarn.lock

serialize-javascript - moderate severity
src/frontend/testcentre/yarn.lock

Add progress info to notification email

When a notification email, it would be great if there was more info in it. Something like:

Hello studentid: foobar,

You have been suspected of plagiarism. You must pass an exam, or you will be referred for administrative action.

This is your 1st of 3 atttempts. The passmark is 70%.

Access your exam here:

You have until to finish your exam.

Add confirmation email when Step Function execution finishes

It would be cool to have a confirmation email at the end of the process.

Success:

You have passed your plagiarism exam. Your score was $blah, and the passmark is $foo.

No further action is required.

Failure:

You have failed your plagiarism exam after $blah attempts. Your most recent score was $foo, and the passmark is $bar.

An administrator will be in touch to discuss next steps.

Add plagiarism exam interface

Integrate a mock exam interface that implements new callback features. Post back dummy results to workflow for validation.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.