Skip to content

Commit 02d4830

Browse files
sebstoSebastien Stormacq
andauthored
[Example] Use smaller containers in all examples (#571)
All the examples using SAM have a default Lambda runtime environment memory size of 512Mb. Lambda functions run in a microVM defined by its memory size. The memory size influences the CPU power. (see https://docs.aws.amazon.com/lambda/latest/dg/configuration-memory.html) Increasing memory size increases runtime performance but also increase costs. As most of our examples are very simple and small functions, 512Mb memory is not required. This PR reduces Lambda runtime execution environment to 128Mb to reduce AWS costs. Co-authored-by: Sebastien Stormacq <[email protected]>
1 parent a1ab8df commit 02d4830

File tree

11 files changed

+14
-13
lines changed

11 files changed

+14
-13
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ Makefile
1414
.devcontainer
1515
.amazonq
1616
.kiro
17-
nodejs
17+
nodejs
18+
.ash

Examples/APIGateway+LambdaAuthorizer/template.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Resources:
3535
Timeout: 60
3636
Handler: swift.bootstrap # ignored by the Swift runtime
3737
Runtime: provided.al2
38-
MemorySize: 512
38+
MemorySize: 128
3939
Architectures:
4040
- arm64
4141
Environment:
@@ -60,7 +60,7 @@ Resources:
6060
Timeout: 29 # max 29 seconds for Lambda authorizers
6161
Handler: swift.bootstrap # ignored by the Swift runtime
6262
Runtime: provided.al2
63-
MemorySize: 512
63+
MemorySize: 128
6464
Architectures:
6565
- arm64
6666
Environment:

Examples/APIGateway/template.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Resources:
1111
Timeout: 60
1212
Handler: swift.bootstrap # ignored by the Swift runtime
1313
Runtime: provided.al2
14-
MemorySize: 512
14+
MemorySize: 128
1515
Architectures:
1616
- arm64
1717
Environment:

Examples/CDK/infra/lib/lambda-api-project-stack.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class LambdaApiStack extends cdk.Stack {
2727
architecture: lambda.Architecture.ARM_64,
2828
handler: 'bootstrap',
2929
code: lambda.Code.fromAsset('../.build/plugins/AWSLambdaPackager/outputs/AWSLambdaPackager/APIGatewayLambda/APIGatewayLambda.zip'),
30-
memorySize: 512,
30+
memorySize: 128,
3131
timeout: cdk.Duration.seconds(30),
3232
environment: {
3333
LOG_LEVEL: 'debug',

Examples/HummingbirdLambda/template.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Resources:
1111
Timeout: 60
1212
Handler: swift.bootstrap # ignored by the Swift runtime
1313
Runtime: provided.al2
14-
MemorySize: 512
14+
MemorySize: 128
1515
Architectures:
1616
- arm64
1717
Environment:

Examples/S3_AWSSDK/template.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Resources:
1111
Timeout: 60
1212
Handler: swift.bootstrap # ignored by the Swift runtime
1313
Runtime: provided.al2
14-
MemorySize: 512
14+
MemorySize: 128
1515
Architectures:
1616
- arm64
1717
Environment:

Examples/S3_Soto/template.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Resources:
1111
Timeout: 60
1212
Handler: swift.bootstrap # ignored by the Swift runtime
1313
Runtime: provided.al2
14-
MemorySize: 512
14+
MemorySize: 128
1515
Architectures:
1616
- arm64
1717
Environment:

Examples/ServiceLifecycle+Postgres/INFRASTRUCTURE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ The infrastructure consists of a secure VPC setup with private subnets only, con
5656
### Service Lifecycle Lambda
5757
- **Runtime**: Custom runtime (provided.al2)
5858
- **Architecture**: ARM64
59-
- **Memory**: 512MB
59+
- **Memory**: 128MB
6060
- **Timeout**: 60 seconds
6161
- **Network**: Deployed in private subnets with access to database within VPC
6262
- **Environment Variables**:

Examples/ServiceLifecycle+Postgres/template.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ Resources:
146146
Timeout: 60
147147
Handler: swift.bootstrap # ignored by the Swift runtime
148148
Runtime: provided.al2
149-
MemorySize: 512
149+
MemorySize: 128
150150
Architectures:
151151
- arm64
152152
VpcConfig:

Examples/Testing/template.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Resources:
1111
Timeout: 60
1212
Handler: swift.bootstrap # ignored by the Swift runtime
1313
Runtime: provided.al2
14-
MemorySize: 512
14+
MemorySize: 128
1515
Architectures:
1616
- arm64
1717
Environment:

0 commit comments

Comments
 (0)