Skip to content

Commit 16fd1e0

Browse files
committed
list manager sample app
1 parent 2fd0bc1 commit 16fd1e0

27 files changed

+177
-54
lines changed

doc_source/applications-tutorial.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ To add a DynamoDB table to the application, define an `AWS::Serverless::SimpleTa
140140
ReadCapacityUnits: 1
141141
WriteCapacityUnits: 1
142142
helloFromLambdaFunction:
143-
Type: AWS::Serverless::Function
143+
Type: [AWS::Serverless::Function](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-function.html)
144144
Properties:
145145
CodeUri: ./
146146
Handler: src/handlers/hello-from-lambda.helloFromLambdaHandler
@@ -229,7 +229,7 @@ Next, update the function code to use the table\. The following code uses the Dy
229229
```
230230
...
231231
helloFromLambdaFunction:
232-
Type: AWS::Serverless::Function
232+
Type: [AWS::Serverless::Function](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-function.html)
233233
Properties:
234234
CodeUri: ./
235235
Handler: src/handlers/index.handler

doc_source/best-practices.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
# Best Practices for Working with AWS Lambda Functions<a name="best-practices"></a>
1+
# Best practices for working with AWS Lambda functions<a name="best-practices"></a>
22

33
The following are recommended best practices for using AWS Lambda:
44

55
**Topics**
6-
+ [Function Code](#function-code)
7-
+ [Function Configuration](#function-configuration)
8-
+ [Alarming and Metrics](#alarming-metrics)
9-
+ [Stream Event Invokes](#stream-events)
6+
+ [Function code](#function-code)
7+
+ [Function configuration](#function-configuration)
8+
+ [Metrics and alarms](#alarming-metrics)
9+
+ [Working with streams](#stream-events)
1010

11-
## Function Code<a name="function-code"></a>
11+
## Function code<a name="function-code"></a>
1212
+ **Separate the Lambda handler from your core logic\.** This allows you to make a more unit\-testable function\. In Node\.js this may look like:
1313

1414
```
@@ -34,7 +34,7 @@ The following are recommended best practices for using AWS Lambda:
3434
+ **Minimize the complexity of your dependencies\.** Prefer simpler frameworks that load quickly on [execution context](runtimes-context.md) startup\. For example, prefer simpler Java dependency injection \(IoC\) frameworks like [Dagger](https://google.github.io/dagger/) or [Guice](https://github.com/google/guice), over more complex ones like [Spring Framework](https://github.com/spring-projects/spring-framework)\.
3535
+ **Avoid using recursive code** in your Lambda function, wherein the function automatically calls itself until some arbitrary criteria is met\. This could lead to unintended volume of function invocations and escalated costs\. If you do accidentally do so, set the function concurrent execution limit to `0` immediately to throttle all invocations to the function, while you update the code\.
3636

37-
## Function Configuration<a name="function-configuration"></a>
37+
## Function configuration<a name="function-configuration"></a>
3838
+ **Performance testing your Lambda function** is a crucial part in ensuring you pick the optimum memory size configuration\. Any increase in memory size triggers an equivalent increase in CPU available to your function\. The memory usage for your function is determined per\-invoke and can be viewed in [AWS CloudWatch Logs](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/WhatIsCloudWatchLogs.html)\. On each invoke a `REPORT:` entry will be made, as shown below:
3939

4040
```
@@ -50,11 +50,11 @@ The following are recommended best practices for using AWS Lambda:
5050
+ In the case of **CreateFunction**, AWS Lambda will fail the function creation process\.
5151
+ In the case of **UpdateFunctionConfiguration**, it could result in duplicate invocations of the function\.
5252

53-
## Alarming and Metrics<a name="alarming-metrics"></a>
53+
## Metrics and alarms<a name="alarming-metrics"></a>
5454
+ **Use [Working with AWS Lambda function metrics](monitoring-metrics.md) and [ CloudWatch Alarms](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html)** instead of creating or updating a metric from within your Lambda function code\. It's a much more efficient way to track the health of your Lambda functions, allowing you to catch issues early in the development process\. For instance, you can configure an alarm based on the expected duration of your Lambda function execution time in order to address any bottlenecks or latencies attributable to your function code\.
5555
+ **Leverage your logging library and [AWS Lambda Metrics and Dimensions](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/lam-metricscollected.html)** to catch app errors \(e\.g\. ERR, ERROR, WARNING, etc\.\)
5656

57-
## Stream Event Invokes<a name="stream-events"></a>
57+
## Working with streams<a name="stream-events"></a>
5858
+ **Test with different batch and record sizes **so that the polling frequency of each event source is tuned to how quickly your function is able to complete its task\. [BatchSize](API_CreateEventSourceMapping.md#SSS-CreateEventSourceMapping-request-BatchSize) controls the maximum number of records that can be sent to your function with each invoke\. A larger batch size can often more efficiently absorb the invoke overhead across a larger set of records, increasing your throughput\.
5959

6060
By default, Lambda invokes your function as soon as records are available in the stream\. If the batch it reads from the stream only has one record in it, Lambda only sends one record to the function\. To avoid invoking the function with a small number of records, you can tell the event source to buffer records for up to 5 minutes by configuring a *batch window*\. Before invoking the function, Lambda continues to read records from the stream until it has gathered a full batch, or until the batch window expires\.

doc_source/build-pipeline.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ Transform: AWS::Serverless-2016-10-31
131131
Description: Outputs the time
132132
Resources:
133133
TimeFunction:
134-
Type: AWS::Serverless::Function
134+
Type: [AWS::Serverless::Function](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-function.html)
135135
Properties:
136136
Handler: index.handler
137137
Runtime: nodejs10.x

doc_source/configuration-console.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,4 @@ For example, to update a function's memory setting with the AWS CLI, use the `up
5555
$ aws lambda update-function-configuration --function-name my-function --memory-size 256
5656
```
5757

58-
For function configuration best practices, see [Function Configuration](best-practices.md#function-configuration)\.
58+
For function configuration best practices, see [Function configuration](best-practices.md#function-configuration)\.

doc_source/csharp-tracing.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ To enable active tracing on an `AWS::Lambda::Function` resource in an AWS CloudF
105105
```
106106
Resources:
107107
function:
108-
Type: AWS::Lambda::Function
108+
Type: [AWS::Lambda::Function](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html)
109109
Properties:
110110
TracingConfig:
111111
Mode: Active
@@ -119,7 +119,7 @@ For an AWS Serverless Application Model \(AWS SAM\) `AWS::Serverless::Function`
119119
```
120120
Resources:
121121
function:
122-
Type: AWS::Serverless::Function
122+
Type: [AWS::Serverless::Function](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-function.html)
123123
Properties:
124124
Tracing: Active
125125
...

doc_source/deploying-lambda-apps.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ The [AWS CLI](gettingstarted-tools.md#gettingstarted-tools-awscli) and [SAM CLI]
1313
+ [Creating an application with continuous delivery in the Lambda console](applications-tutorial.md)
1414
+ [Rolling deployments for Lambda functions](lambda-rolling-deployments.md)
1515
+ [Common Lambda application types and use cases](applications-usecases.md)
16-
+ [Best Practices for Working with AWS Lambda Functions](best-practices.md)
16+
+ [Best practices for working with AWS Lambda functions](best-practices.md)

doc_source/golang-tracing.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ To enable active tracing on an `AWS::Lambda::Function` resource in an AWS CloudF
8181
```
8282
Resources:
8383
function:
84-
Type: AWS::Lambda::Function
84+
Type: [AWS::Lambda::Function](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html)
8585
Properties:
8686
TracingConfig:
8787
Mode: Active
@@ -95,7 +95,7 @@ For an AWS Serverless Application Model \(AWS SAM\) `AWS::Serverless::Function`
9595
```
9696
Resources:
9797
function:
98-
Type: AWS::Serverless::Function
98+
Type: [AWS::Serverless::Function](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-function.html)
9999
Properties:
100100
Tracing: Active
101101
...

doc_source/index.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Amazon's trademarks and trade dress may not be used in
6060
+ [Creating an application with continuous delivery in the Lambda console](applications-tutorial.md)
6161
+ [Rolling deployments for Lambda functions](lambda-rolling-deployments.md)
6262
+ [Common Lambda application types and use cases](applications-usecases.md)
63-
+ [Best Practices for Working with AWS Lambda Functions](best-practices.md)
63+
+ [Best practices for working with AWS Lambda functions](best-practices.md)
6464
+ [Using AWS Lambda with other services](lambda-services.md)
6565
+ [Using AWS Lambda with Alexa](services-alexa.md)
6666
+ [Using AWS Lambda with Amazon API Gateway](services-apigateway.md)
@@ -119,6 +119,7 @@ Amazon's trademarks and trade dress may not be used in
119119
+ [Lambda sample applications](lambda-samples.md)
120120
+ [Blank function sample application for AWS Lambda](samples-blank.md)
121121
+ [Error processor sample application for AWS Lambda](samples-errorprocessor.md)
122+
+ [List manager sample application for AWS Lambda](samples-listmanager.md)
122123
+ [Building Lambda functions with Node.js](lambda-nodejs.md)
123124
+ [AWS Lambda function handler in Node.js](nodejs-handler.md)
124125
+ [AWS Lambda deployment package in Node.js](nodejs-package.md)

doc_source/java-package.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ Transform: 'AWS::Serverless-2016-10-31'
264264
Description: An AWS Lambda application that calls the Lambda API.
265265
Resources:
266266
function:
267-
Type: AWS::Serverless::Function
267+
Type: [AWS::Serverless::Function](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-function.html)
268268
Properties:
269269
CodeUri: build/distributions/java-basic.zip
270270
Handler: example.Handler

doc_source/java-tracing.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ To enable active tracing on an `AWS::Lambda::Function` resource in an AWS CloudF
8888
```
8989
Resources:
9090
function:
91-
Type: AWS::Lambda::Function
91+
Type: [AWS::Lambda::Function](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html)
9292
Properties:
9393
TracingConfig:
9494
Mode: Active
@@ -102,7 +102,7 @@ For an AWS Serverless Application Model \(AWS SAM\) `AWS::Serverless::Function`
102102
```
103103
Resources:
104104
function:
105-
Type: AWS::Serverless::Function
105+
Type: [AWS::Serverless::Function](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-function.html)
106106
Properties:
107107
Tracing: Active
108108
...
@@ -119,15 +119,15 @@ The following example shows an `AWS::Serverless::LayerVersion` resource that sto
119119
```
120120
Resources:
121121
function:
122-
Type: AWS::Serverless::Function
122+
Type: [AWS::Serverless::Function](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-function.html)
123123
Properties:
124124
CodeUri: build/distributions/blank-java.zip
125125
Tracing: Active
126126
Layers:
127127
- !Ref libs
128128
...
129129
libs:
130-
Type: AWS::Serverless::LayerVersion
130+
Type: [AWS::Serverless::LayerVersion](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-layerversion.html)
131131
Properties:
132132
LayerName: blank-java-lib
133133
Description: Dependencies for the blank-java sample app.

doc_source/kinesis-tutorial-spec.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ AWSTemplateFormatVersion: '2010-09-09'
1111
Transform: AWS::Serverless-2016-10-31
1212
Resources:
1313
ProcessDynamoDBStream:
14-
Type: AWS::Serverless::Function
14+
Type: [AWS::Serverless::Function](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-function.html)
1515
Properties:
1616
Handler: handler
1717
Runtime: runtime

doc_source/lambda-releases.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ The following table describes the important changes to the *AWS Lambda Developer
44

55
| Change | Description | Date |
66
| --- |--- |--- |
7-
| [AWS CDK sample applications in the Lambda console](https://docs.aws.amazon.com/lambda/latest/dg/applications-tutorial.html?icmpid=docs_lambda_rss) | The Lambda console now includes sample applications that use the AWS Cloud Development Kit \(AWS CDK\) for TypeScript\. The AWS CDK is a framework that enables you to define your application resources in TypeScript, Python, Java, or \.NET\. For details, see [Creating an application with continuous delivery in the Lambda console](https://docs.aws.amazon.com/lambda/latest/dg/applications-tutorial.html?icmpid=docs_lambda_rss)\. | June 1, 2020 |
7+
| [AWS CDK sample applications in the Lambda console](https://docs.aws.amazon.com/lambda/latest/dg/applications-tutorial.html?icmpid=docs_lambda_rss) | The Lambda console now includes sample applications that use the AWS Cloud Development Kit \(AWS CDK\) for TypeScript\. The AWS CDK is a framework that enables you to define your application resources in TypeScript, Python, Java, or \.NET\. For a tutorial on creating applications, see [Creating an application with continuous delivery in the Lambda console](https://docs.aws.amazon.com/lambda/latest/dg/applications-tutorial.html?icmpid=docs_lambda_rss)\. | June 1, 2020 |
88
| [Support for \.NET Core 3\.1\.0 runtime in AWS Lambda](https://docs.aws.amazon.com/lambda/latest/dg/csharp-package-cli.html?icmpid=docs_lambda_rss) | AWS Lambda now supports the \.NET Core 3\.1\.0 runtime\. For details, see [\.NET Core CLI](https://docs.aws.amazon.com/lambda/latest/dg/csharp-package-cli.html?icmpid=docs_lambda_rss)\. | March 31, 2020 |
99
| [Support for API Gateway HTTP APIs](https://docs.aws.amazon.com/lambda/latest/dg/services-apigateway.html?icmpid=docs_lambda_rss) | Updated and expanded documentation for using Lambda with API Gateway, including support for HTTP APIs\. Added a sample application that creates an API and function with AWS CloudFormation\. For details, see [Using AWS Lambda with Amazon API Gateway](https://docs.aws.amazon.com/lambda/latest/dg/services-apigateway.html?icmpid=docs_lambda_rss)\. | March 23, 2020 |
1010
| [Ruby 2\.7](https://docs.aws.amazon.com/lambda/latest/dg/lambda-ruby.html?icmpid=docs_lambda_rss) | A new runtime is available for Ruby 2\.7, ruby2\.7, which is the first Ruby runtime to use Amazon Linux 2\. For details, see [Building Lambda functions with Ruby](https://docs.aws.amazon.com/lambda/latest/dg/lambda-ruby.html?icmpid=docs_lambda_rss)\. | February 19, 2020 |

doc_source/lambda-rolling-deployments.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Description: A sample SAM template for deploying Lambda functions.
2828
Resources:
2929
# Details about the myDateTimeFunction Lambda function
3030
myDateTimeFunction:
31-
Type: AWS::Serverless::Function
31+
Type: [AWS::Serverless::Function](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-function.html)
3232
Properties:
3333
Handler: myDateTimeFunction.handler
3434
Runtime: nodejs12.x

doc_source/lambda-samples.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,5 @@ To deploy a sample application, follow the instructions in its README file\. To
5959

6060
**Topics**
6161
+ [Blank function sample application for AWS Lambda](samples-blank.md)
62-
+ [Error processor sample application for AWS Lambda](samples-errorprocessor.md)
62+
+ [Error processor sample application for AWS Lambda](samples-errorprocessor.md)
63+
+ [List manager sample application for AWS Lambda](samples-listmanager.md)

doc_source/nodejs-tracing.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ To enable active tracing on an `AWS::Lambda::Function` resource in an AWS CloudF
109109
```
110110
Resources:
111111
function:
112-
Type: AWS::Lambda::Function
112+
Type: [AWS::Lambda::Function](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html)
113113
Properties:
114114
TracingConfig:
115115
Mode: Active
@@ -123,7 +123,7 @@ For an AWS Serverless Application Model \(AWS SAM\) `AWS::Serverless::Function`
123123
```
124124
Resources:
125125
function:
126-
Type: AWS::Serverless::Function
126+
Type: [AWS::Serverless::Function](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-function.html)
127127
Properties:
128128
Tracing: Active
129129
...
@@ -140,15 +140,15 @@ The following example shows an `AWS::Serverless::LayerVersion` resource that sto
140140
```
141141
Resources:
142142
function:
143-
Type: AWS::Serverless::Function
143+
Type: [AWS::Serverless::Function](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-function.html)
144144
Properties:
145145
CodeUri: function/.
146146
Tracing: Active
147147
Layers:
148148
- !Ref libs
149149
...
150150
libs:
151-
Type: AWS::Serverless::LayerVersion
151+
Type: [AWS::Serverless::LayerVersion](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-layerversion.html)
152152
Properties:
153153
LayerName: blank-nodejs-lib
154154
Description: Dependencies for the blank sample app.

doc_source/python-tracing.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ To enable active tracing on an `AWS::Lambda::Function` resource in an AWS CloudF
100100
```
101101
Resources:
102102
function:
103-
Type: AWS::Lambda::Function
103+
Type: [AWS::Lambda::Function](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html)
104104
Properties:
105105
TracingConfig:
106106
Mode: Active
@@ -114,7 +114,7 @@ For an AWS Serverless Application Model \(AWS SAM\) `AWS::Serverless::Function`
114114
```
115115
Resources:
116116
function:
117-
Type: AWS::Serverless::Function
117+
Type: [AWS::Serverless::Function](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-function.html)
118118
Properties:
119119
Tracing: Active
120120
...
@@ -131,15 +131,15 @@ The following example shows an `AWS::Serverless::LayerVersion` resource that sto
131131
```
132132
Resources:
133133
function:
134-
Type: AWS::Serverless::Function
134+
Type: [AWS::Serverless::Function](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-function.html)
135135
Properties:
136136
CodeUri: function/.
137137
Tracing: Active
138138
Layers:
139139
- !Ref libs
140140
...
141141
libs:
142-
Type: AWS::Serverless::LayerVersion
142+
Type: [AWS::Serverless::LayerVersion](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-layerversion.html)
143143
Properties:
144144
LayerName: blank-python-lib
145145
Description: Dependencies for the blank-python sample app.

doc_source/ruby-tracing.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ To enable active tracing on an `AWS::Lambda::Function` resource in an AWS CloudF
102102
```
103103
Resources:
104104
function:
105-
Type: AWS::Lambda::Function
105+
Type: [AWS::Lambda::Function](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html)
106106
Properties:
107107
TracingConfig:
108108
Mode: Active
@@ -116,7 +116,7 @@ For an AWS Serverless Application Model \(AWS SAM\) `AWS::Serverless::Function`
116116
```
117117
Resources:
118118
function:
119-
Type: AWS::Serverless::Function
119+
Type: [AWS::Serverless::Function](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-function.html)
120120
Properties:
121121
Tracing: Active
122122
...
@@ -133,15 +133,15 @@ The following example shows an `AWS::Serverless::LayerVersion` resource that sto
133133
```
134134
Resources:
135135
function:
136-
Type: AWS::Serverless::Function
136+
Type: [AWS::Serverless::Function](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-function.html)
137137
Properties:
138138
CodeUri: function/.
139139
Tracing: Active
140140
Layers:
141141
- !Ref libs
142142
...
143143
libs:
144-
Type: AWS::Serverless::LayerVersion
144+
Type: [AWS::Serverless::LayerVersion](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-layerversion.html)
145145
Properties:
146146
LayerName: blank-ruby-lib
147147
Description: Dependencies for the blank-ruby sample app.

0 commit comments

Comments
 (0)