You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# No Functions Have Memory Configuration Left as Default (no-default-memory)
8
+
9
+
Lambda Functions memory is configurable and should be configured for the use-case.
10
+
This can impact the speed and running cost of the Lambda Function.
11
+
12
+
> **Note:** Any increase in memory size triggers an equivalent increase in CPU available to your function
13
+
14
+
---
15
+
16
+
## Suggested Actions:
17
+
18
+
- Look into your CloudWatch Logs for the Lambda function to find `Max Memory Used`[more information](https://docs.aws.amazon.com/lambda/latest/dg/best-practices.html)
19
+
20
+
```
21
+
REPORT RequestId: 3604209a-e9a3-11e6-939a-754dd98c7be3 Duration: 12.34 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 18 MB
22
+
```
23
+
24
+
- Power-tune using [aws-lambda-power-tuning](https://github.com/alexcasalboni/aws-lambda-power-tuning)
# No Functions Have Timeout Configuration Left as Default (no-default-timeout)
8
+
9
+
Lambda Function timeout is configurable and should be configured for the use-case.
10
+
This can impact timeout errors, running costs and security (e.g. "Denial of Wallet").
11
+
The default is 3 seconds in AWS, but 6 with the Serverless Framework.
12
+
The maximum allowed value is 900 seconds.
13
+
14
+
< 5 seconds is generally suitable for API endpoints.
15
+
16
+
> **Note:** API Gateway has a limit of 29 seconds.
17
+
18
+
---
19
+
20
+
## Suggested Actions:
21
+
22
+
- Look into your CloudWatch Logs for the Lambda function to find `Duration` ([more information](https://docs.aws.amazon.com/lambda/latest/dg/best-practices.html))
23
+
24
+
```
25
+
REPORT RequestId: 3604209a-e9a3-11e6-939a-754dd98c7be3 Duration: 12.34 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 18 MB
26
+
```
27
+
28
+
- Power-tune using [aws-lambda-power-tuning](https://github.com/alexcasalboni/aws-lambda-power-tuning)
29
+
> **Note:** Any increase in memory size triggers an equivalent increase in CPU available to your function, which can be useful in lowering timeout.
# No Functions Have Identical Deployment Code (no-identical-code)
8
+
9
+
Lambda Function should have their code packaged optimally as it may affect cold start times.
10
+
Also, deploying a monolithic codebase is not advised.
11
+
12
+
---
13
+
14
+
## Suggested Actions:
15
+
16
+
- Look at your deployment artifact to see if there is code that should be removed.
17
+
- If you're using the Serverless Framework specify individual packaging [more info](https://www.serverless.com/framework/docs/providers/aws/guide/packaging/):
18
+
19
+
```
20
+
service: my-service
21
+
22
+
package:
23
+
individually: true
24
+
25
+
```
26
+
27
+
- Use the `serverless package` command if you use the serverless framework.
28
+
- Look in the `.serverless` directory to see the deployment artifacts.
# No Functions Have Memory Configuration To Maximum Limit (no-max-memory)
8
+
9
+
Lambda Functions memory is configurable and should be configured for the use-case.
10
+
This can impact the speed and running cost of the Lambda Function.
11
+
12
+
> **Note:** Any increase in memory size triggers an equivalent increase in CPU available to your function
13
+
14
+
---
15
+
16
+
## Suggested Actions:
17
+
18
+
- Look into your CloudWatch Logs for the Lambda function to find `Max Memory Used`[more information](https://docs.aws.amazon.com/lambda/latest/dg/best-practices.html)
19
+
20
+
```
21
+
REPORT RequestId: 3604209a-e9a3-11e6-939a-754dd98c7be3 Duration: 12.34 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 18 MB
22
+
```
23
+
24
+
- Power-tune using [aws-lambda-power-tuning](https://github.com/alexcasalboni/aws-lambda-power-tuning)
# No Functions Have Timeout Configuration To Maximum Limit (no-max-timeout)
8
+
9
+
Lambda Function timeout is configurable and should be configured for the use-case.
10
+
Having it set at the maximum is rarely appropriate, unless processing a lot of data.
11
+
The default is 3 seconds in AWS, but 6 with the Serverless Framework.
12
+
The maximum allowed value is 900 seconds.
13
+
14
+
Having it set at the maximum can allow inefficient code to be released, increased billed duration in case of code errors and can lead to expensive cloud bills via "Denial of Wallet" attacks.
15
+
16
+
< 5 seconds is generally suitable for API endpoints.
17
+
18
+
---
19
+
20
+
## Suggested Actions:
21
+
22
+
- Look into your CloudWatch Logs for the Lambda function to find `Duration` ([more information](https://docs.aws.amazon.com/lambda/latest/dg/best-practices.html))
23
+
24
+
```
25
+
REPORT RequestId: 3604209a-e9a3-11e6-939a-754dd98c7be3 Duration: 12.34 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 18 MB
26
+
```
27
+
28
+
- Power-tune using [aws-lambda-power-tuning](https://github.com/alexcasalboni/aws-lambda-power-tuning)
29
+
> **Note:** Any increase in memory size triggers an equivalent increase in CPU available to your function, which can be useful in lowering timeout.
# No Functions Have Shared IAM Roles (no-shared-roles)
8
+
9
+
IAM Roles allow granular access control to be specified per function.
10
+
To ensure least privilege, one role should be used per function so that the underlying policy can be configured correctly.
11
+
12
+
---
13
+
14
+
## Suggested Actions:
15
+
16
+
- Define one IAM Role per Function and configure them to ensure least privilege.
17
+
- If you're using the Serverless Framework, you can use the [serverless-iam-roles-per-function](https://github.com/functionalone/serverless-iam-roles-per-function) plugin.
Copy file name to clipboardexpand all lines: src/guardian/rules/best_practices/no-default-memory/index.js
+1-1
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ class NoDefaultMemory {
10
10
this.failureMessage=
11
11
"The following functions have their memory set as default.";
12
12
this.rulePage=
13
-
"See (https://github.com/Theodo-UK/sls-dev-tools/blob/guardian-ci/src/guardian/rules/best_practices/no-default-memory/no-default-memory.MD) for impact and how to to resolve.";
13
+
"See (https://theodo-uk.github.io/sls-dev-tools/docs/no-default-memory) for impact and how to to resolve.";
Copy file name to clipboardexpand all lines: src/guardian/rules/best_practices/no-default-timeout/index.js
+1-1
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ class NoDefaultTimeout {
11
11
this.failureMessage=
12
12
"The following functions have their timeout set as default.";
13
13
this.rulePage=
14
-
"See (https://github.com/Theodo-UK/sls-dev-tools/blob/guardian-ci/src/guardian/rules/best_practices/no-default-timeout/no-default-timeout.MD) for impact and how to to resolve.";
14
+
"See (https://theodo-uk.github.io/sls-dev-tools/docs/no-default-timeout) for impact and how to to resolve.";
Copy file name to clipboardexpand all lines: src/guardian/rules/best_practices/no-identical-code/index.js
+1-1
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ class NoIdenticalCode {
9
9
this.failureMessage=
10
10
"The following functions have identical deployment code repeated in 1 or more other functions.";
11
11
this.rulePage=
12
-
"See (https://github.com/Theodo-UK/sls-dev-tools/blob/guardian-ci/src/guardian/rules/best_practices/no-identical-code/no-identical-code.MD) for impact and how to to resolve.";
12
+
"See (https://theodo-uk.github.io/sls-dev-tools/docs/no-identical-code) for impact and how to to resolve.";
Copy file name to clipboardexpand all lines: src/guardian/rules/best_practices/no-max-memory/index.js
+1-1
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ class NoMaximumMemory {
10
10
this.failureMessage=
11
11
"The following functions have their memory set to the maximum limit.";
12
12
this.rulePage=
13
-
"See (https://github.com/Theodo-UK/sls-dev-tools/blob/guardian-ci/src/guardian/rules/best_practices/no-max-memory/no-max-memory.MD) for impact and how to to resolve.";
13
+
"See (https://theodo-uk.github.io/sls-dev-tools/docs/no-max-memory) for impact and how to to resolve.";
Copy file name to clipboardexpand all lines: src/guardian/rules/best_practices/no-max-timeout/index.js
+1-1
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ class NoMaximumTimeout {
10
10
this.failureMessage=
11
11
"The following functions have their timeout set as the maximum.";
12
12
this.rulePage=
13
-
"See (https://github.com/Theodo-UK/sls-dev-tools/blob/guardian-ci/src/guardian/rules/best_practices/no-max-timeout/no-max-timeout.MD) for impact and how to to resolve.";
13
+
"See (https://theodo-uk.github.io/sls-dev-tools/docs/no-max-timeout) for impact and how to to resolve.";
Copy file name to clipboardexpand all lines: src/guardian/rules/best_practices/no-shared-roles/index.js
+1-1
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ class NoSharedRoles {
9
9
this.failureMessage=
10
10
"The following functions have roles used by 1 or more other functions.";
11
11
this.rulePage=
12
-
"See (https://github.com/Theodo-UK/sls-dev-tools/blob/guardian-ci/src/guardian/rules/best_practices/no-shared-roles/no-shared-roles.MD) for impact and how to to resolve.";
12
+
"See (https://theodo-uk.github.io/sls-dev-tools/docs/no-shared-roles) for impact and how to to resolve.";
0 commit comments