Skip to content

Commit b260701

Browse files
update readme and ready for review
1 parent b2dd36f commit b260701

1 file changed

Lines changed: 67 additions & 4 deletions

File tree

serverless/README.md

Lines changed: 67 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,26 @@ tags:
1414
Serverless eliminates the need to plan for infrastructure and let's you focus on your
1515
application.
1616

17+
Following are optimization katas you should be aware of while building a serverless
18+
applications
19+
20+
* The Lean function
21+
* Concise logic
22+
* Efficient/single purpose code
23+
* ephemeral environment
24+
* Eventful Invocations
25+
* Succinct payloads
26+
* resilient routing
27+
* concurrent execution
28+
* Coordinated calls
29+
* Decoupled via APIs
30+
* scale-matched downstream
31+
* secured
32+
* Serviceful operations
33+
* Automated operations
34+
* monitored applications
35+
* Innovation mindset
36+
1737
## Intent
1838

1939
Whether to reduce your infrastructure costs, shrink the time you spend on ops tasks,
@@ -58,6 +78,10 @@ an Event. Most of the Serverless Cloud Providers support following Events
5878
AWS supports processing event generated from AWS Services (S3/Cloudwatch/etc) and
5979
using aws as a compute engine is our first choice.
6080

81+
## (Backend as a Service or "BaaS")
82+
This example creates a backend for ‘persons’ collection which uses DynamoDB NoSQL
83+
database service also provided by Amazon.
84+
6185
## AWS lambda function implementation
6286

6387
AWS lambda SDK provides pre-defined interface `com.amazonaws.services.lambda.runtime
@@ -97,16 +121,23 @@ dependencies of the function.
97121
* `mvn clean package`
98122
* `serverless deploy --stage=dev --verbose`
99123

100-
Based on the configuration in `serverless.yml` serverless framework creates a
101-
cloud formation stack for S3 (ServerlessDeploymentBucket), IAM Role
102-
(IamRoleLambdaExecution), cloud watch (log groups), API Gateway (ApiGatewayRestApi)
103-
and the Lambda function.
124+
Based on the configuration in `serverless.yml` serverless framework creates following
125+
resources
126+
* cloud formation stack for S3 (ServerlessDeploymentBucket)
127+
* IAM Role (IamRoleLambdaExecution)
128+
* cloud watch (log groups)
129+
* API Gateway (ApiGatewayRestApi)
130+
* Lambda function
131+
* DynamoDB collection
104132

105133
The command will print out Stack Outputs which looks something like this
106134

107135
```yaml
108136
endpoints:
109137
GET - https://xxxxxxxxx.execute-api.us-east-1.amazonaws.com/dev/info
138+
POST - https://xxxxxxxxx.execute-api.us-east-1.amazonaws.com/dev/api/person
139+
GET - https://xxxxxxxxx.execute-api.us-east-1.amazonaws.com/dev/api/person/{id}
140+
110141
```
111142
112143
```yaml
@@ -116,6 +147,38 @@ ServerlessDeploymentBucketName: lambda-info-http-endpoin-serverlessdeploymentbuc
116147
```
117148
access the endpoint to invoke the function.
118149
150+
Use the following cURL commands to test the endpoints
151+
152+
```cURL
153+
curl -X GET \
154+
https://xxxxxxxxx.execute-api.us-east-1.amazonaws.com/dev/info \
155+
-H 'cache-control: no-cache'
156+
```
157+
158+
```cURL
159+
curl -X POST \
160+
https://xxxxxxxxx.execute-api.us-east-1.amazonaws.com/dev/api/person \
161+
-H 'cache-control: no-cache' \
162+
-H 'content-type: application/json' \
163+
-d '{
164+
"firstName": "Thor",
165+
"lastName": "Odinson",
166+
"address": {
167+
"addressLineOne": "1 Odin ln",
168+
"addressLineTwo": "100",
169+
"city": "Asgard",
170+
"state": "country of the Gods",
171+
"zipCode": "00001"
172+
}
173+
}'
174+
```
175+
176+
```cURL
177+
curl -X GET \
178+
https://xxxxxxxxx.execute-api.us-east-1.amazonaws.com/dev/api/person/{id} \
179+
-H 'cache-control: no-cache'
180+
```
181+
119182
## Credits
120183

121184
* [serverless docs](https://serverless.com/framework/docs/)

0 commit comments

Comments
 (0)