Skip to content

Commit aaaaf17

Browse files
committed
README updated
1 parent 324fb94 commit aaaaf17

File tree

1 file changed

+73
-1
lines changed

1 file changed

+73
-1
lines changed

README.md

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,73 @@
1-
# simple-aws-lambda-mongodb
1+
# simple-aws-lambda-mongodb
2+
3+
This example demonstrates how to deploy a [NodeJS](https://nodejs.org/en/docs/) function running on [AWS Lambda](https://aws.amazon.com/lambda/) using the traditional [Serverless](https://www.serverless.com/framework/docs/providers/aws/guide/intro) Framework. The deployed function works with multiple type of event definitions.
4+
5+
This Example works with both `cron` events and `httpApi` events.
6+
7+
When deployed the [AWS Lambda](https://aws.amazon.com/lambda/) function sends Emails by using [AWS Simple Email Service(SES)](https://aws.amazon.com/ses/). Now the Emails can be sent either by an [AWS HTTP API](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop.html) event or by a `cron` like fashion to a stipulated time interval set in the [AWS Cloudformation](https://aws.amazon.com/cloudformation/) Stack.
8+
9+
All *logs* for the function is kept in [AWS Cloudwatch](https://aws.amazon.com/cloudwatch/) i.e *persistent*. [AWS EventBridge](https://aws.amazon.com/about-aws/whats-new/2019/07/introducing-amazon-eventbridge/) is used to handle **both** types of `schedule` and `http` events.
10+
11+
To use the code in this example you **must** have an valid [AWS account](https://aws.amazon.com/account/) and necessary [AWS IAM](https://aws.amazon.com/iam/) roles and programmatic access to an user.
12+
13+
## Features
14+
1. [AWS Lambda](https://aws.amazon.com/lambda/) function using [NodeJS](https://nodejs.org/en/docs/)
15+
2. Function is using latest version of [AWS SDK JavaScript v3](https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/welcome.html) with all **ES6+** syntaxes like Promises, `async/await`
16+
17+
<ol start="3">
18+
<li>
19+
Function are deployed using <a href="https://www.serverless.com/framework/docs/providers/aws/guide/intro">Serverless</a> Framework.
20+
</li>
21+
<li>
22+
<code>serverless.json</code> is used for deployment configuration instead of <code>serverless.yml</code>.
23+
</li>
24+
<li>
25+
All the deployment is created in <a href="https://aws.amazon.com/s3/">AWS S3</a> to store the <code>.zip</code> of the function code and <a href="https://aws.amazon.com/cloudformation/">AWS CloudFormation</a> Stack.
26+
</li>
27+
</ol>
28+
29+
30+
6. **Two** types of events are supported `httpAPi` and `schedule`
31+
7. [AWS HTTP API](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop.html) are using [AWS API GateWay](https://aws.amazon.com/api-gateway/)
32+
33+
<ol start="8">
34+
<li> All Emails are sent using <a href="https://aws.amazon.com/ses/">AWS Simple Email Service(SES)</a>. For that purpose valid <i>Identities</i> must be created.</li>
35+
<li> Email Templates are created using <a href="https://www.w3schools.com/html/default.asp">HTML5</a> and <a href="https://www.w3schools.com/css/">CSS3</a></li>
36+
<li> This APIs can also be consumed by any <b>Frontend Application</b>.</li>
37+
</ol>
38+
39+
11. [NPM](https://www.npmjs.com/) dependencies are used for various purposes.
40+
12. **Custom Headers** are added with the response for *obvious security* reasons.
41+
42+
## Usage
43+
44+
First clone the repo
45+
46+
```bash
47+
$ git clone git@github.com:anijitsahu/simple-aws-lambda-ses-cron.git
48+
```
49+
Install all the necessary dependencies by going inside the directory
50+
51+
```bash
52+
$ cd simple-aws-lambda-ses-cron.git
53+
$ npm install
54+
```
55+
56+
57+
### Deployment
58+
59+
In order to deploy the example, you need to run the following command:
60+
61+
```
62+
$ serverless deploy
63+
```
64+
65+
### Invocation
66+
67+
After successful deployment, you can invoke the deployed function.
68+
All the `cron` events will invoke the deployed functions in stipulated time interval.
69+
70+
However, to call using `httpApi` you can use any REST Client like [Talend API Tester](https://chrome.google.com/webstore/detail/talend-api-tester-free-ed/aejoelaoggembcahagimdiliamlcdmfm?hl=en) with the `url` and *HTTP Verbs* as shown in Terminal after using `serverless deploy`.
71+
72+
73+

0 commit comments

Comments
 (0)