Skip to content

Commit 59e8473

Browse files
committed
Merge branch 'master' of github.com:markusklems/aws-lambda-java-example
2 parents ffb36c0 + 04bc55c commit 59e8473

File tree

1 file changed

+11
-27
lines changed

1 file changed

+11
-27
lines changed

README.md

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,17 @@
22

33
A simple Java Lambda based server-less application that implements a reimbursement use case, with AWS Lambda, AWS API Gateway, AWS SES, and AWS DynamoDB. Set up the project with Eclipse and AWS Toolkit plugin.
44

5-
## Getting Started
6-
### IDE Setup
7-
1. Open Eclipse
8-
2. Install the AWS Toolkit for Eclipse and set up your AWS access key id and secret access key: http://docs.aws.amazon.com/AWSToolkitEclipse/latest/ug/tke_setup_install.html
9-
3. Import project LambdaForm: Right click on the Package Explorer > Import > General > Existing Projects into Workspace. Do the same for LambdaSendMail and LambdaApproval.
10-
4. Sign up for AWS Lambda, API Gateway, DynamoDB, and SES (if you have not done so, yet).
5+
Please take a look at the wiki for a detailed [Getting Started - Step-by-Step](https://github.com/markusklems/aws-lambda-java-example/wiki/Getting-Started) guide.
116

12-
### Upload Lambda Functions
13-
1. Right click on the LambdaForm project folder > Amazon Web Services > Upload Function to AWS Lambda > Follow the steps in the wizard and create a new Lambda Function.
14-
2. Upload the Lambda Functions of the other two projects LambdaSendMail and LambdaApproval.
15-
3. Give the Lambda Functions an IAM role that allows access to DynamoDB and SES.
7+
## Getting Started (Short)
8+
1. Set up Eclipse, import the projects, and install the AWS Eclipse Toolkit plugin.
9+
2. Upload the Lambda Functions (Right click on project > Amazon Web Services > Upload Function to AWS Lambda)
10+
3. Set up a DynamoDB table 'lambda-reimbursment' with Hash Key 'employee_id' (String). Set the DynamoDB tables as event source for LambdaSendMail and LambdaApproval. Create an API method, so that a click on the link (HTTP GET) calls the LambdaApproval Function (with a parameter 'employee_id').
11+
4. Call the LambdaForm Function from Eclipse with the following JSON input:
12+
```{"employee_id":"1", "employee_name":"John Doh", "expense_type":"travel","amount": "456.75" }```
1613

17-
### AWS Services setup
18-
1. Set up a DynamoDB table named 'lambda-reimbursment' with the Hash Key 'employee_id' of type String. In the example, the EU-WEST-1 region (Ireland) is chosen.
19-
2. In the AWS dashboard, go to Lambda > LambdaSendMail > Event source. Add an event source of type DynamoDB (table: lambda-reimbursment) with default settings.
20-
3. Do the same (as in step 2) for LambdaApproval.
21-
4. In the AWS dashboard, go to API Gateway and create a new API that points at the LambdaApproval Function. Create a Resource "reimbursment" and a GET method. Click on "Method Request" and add a query string parameter "id". Click on "Integration Request" and add a Mapping Template with content type "application/json" and Template:
22-
```
23-
{
24-
"employee_id" : "$input.params('id')"
25-
}
26-
```
27-
Deploy the API.
14+
If the Lambda Function completes successfully, a new entry will be added to the DynamoDB table lambda-reimbursment.
15+
LambdaSendMail gets triggered by the DynamoDB stream (pull model) and sends an e-mail with the info that has been added to the table.
16+
If you have received the e-mail and click on the approval URL in the e-mail body, the LambdaApproval Function will be called and add an "approved" column entry to DynamoDB.
2817

29-
### Run Lambda Functions
30-
1. Right click on the LambdaForm project folder > Amazon Web Services > Run Function on AWS Lambda > Enter a JSON object like this one:
31-
```{"employee_id":"1", "employee_name":"John Doh", "expense_type":"travel","amount": "456.75" }```
32-
2. If the Lambda Function completes successfully, a new entry will be added to the DynamoDB table lambda-reimbursment that you created in step 1 of the AWS Services setup.
33-
3. LambdaSendMail gets triggered by the DynamoDB stream (pull model) and sends an e-mail with the info that has been added to the table.
34-
4. If you have received the e-mail and click on the approval URL in the e-mail body, the LambdaApproval Function will be called and add an "approved" column entry to DynamoDB.
18+
More detailed "Getting Started" info: https://github.com/markusklems/aws-lambda-java-example/wiki/Getting-Started

0 commit comments

Comments
 (0)