https://github.com/awsimaya/commentsapi
Creates a Serverless ASP.NET Web API using Amazon Comprehend services
https://github.com/awsimaya/commentsapi
aws comprehend csharp netcore
Last synced: about 2 months ago
JSON representation
Creates a Serverless ASP.NET Web API using Amazon Comprehend services
- Host: GitHub
- URL: https://github.com/awsimaya/commentsapi
- Owner: awsimaya
- Created: 2018-07-12T18:00:41.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-09-24T02:35:56.000Z (almost 8 years ago)
- Last Synced: 2025-02-17T03:29:22.466Z (over 1 year ago)
- Topics: aws, comprehend, csharp, netcore
- Language: C#
- Size: 84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
## What does this application do?
This project has a lambda function that takes a text string as input, identifies the sentiment of the text through Amazon Comprehend service. If the text is found to have a _NEGATIVE_ sentiment, it triggers a notification to a topic. All subscribers to that topic will receive the notification message.
## Setup Instructions (for Visual Studio on Windows)
* Clone the repository to your local machine
* Create an IAM Role and attach the following policies to it
* ComprehendReadOnly
* AmazonSNSFullAccess
* Open serverless.template file and update the _Role_ attribute with the ARN of the IAM Policy you created in the previous step
* Build and make sure there are no build errors
* Right click on the project name and select _Publish to AWS Lambda..._ from the context menu
* Make sure the value for _ShouldCreateSNSTopic_ is set to true when you run the template for the first time and publish
* Once completed successfully, you should be able to see a setup similar to this on the AWS Lambda console

* Navigate to SNS home page on the AWS Console, you should be able to see a new topic called _CommentNotifier_ there
* Create a new email subscription to the topic and set it up to receive emails
* In your project, open CommentsController.cs and update the _TargetArn_ property with the ARN of the CommentNotifier topic from the AWS Console
* Publish the template once again
* You should be able to invoke the Lambda through the API Gateway using Postman or similar tools. If you send a negative text, the Lambda will sense it through AWS Comprehend and send you a notification through SNS
## Here are some steps to follow to get started from the command line:
Once you have edited your template and code you can use the following command lines to deploy your application from the command line (these examples assume the project name is *CommentsAPI*):
Restore dependencies
```
cd "CommentsAPI"
dotnet restore
```
Execute unit tests
```
cd "CommentsAPI/test/CommentsAPI.Tests"
dotnet test
```
Deploy application
```
cd "CommentsAPI/src/CommentsAPI"
dotnet lambda deploy-serverless
```