Skip to content

Commit c0bc7c9

Browse files
authored
feat: Update (and streamline) the default runtime to be DOTNET_8 (#260)
The default runtime was set to `DOTNET_6` while the docs said `PROVIDED_AL2`. This PR streamlines this, and changes the default runtime to be `DOTNET_8`.
1 parent 692dfc1 commit c0bc7c9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+251
-221
lines changed

API.md

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/function.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export interface DotNetFunctionProps extends lambda.FunctionOptions {
1313
/**
1414
* The runtime environment. Only runtimes of the .NET family and provided family are supported.
1515
*
16-
* @default lambda.Runtime.PROVIDED_AL2
16+
* @default lambda.Runtime.DOTNET_8
1717
*/
1818
readonly runtime?: lambda.Runtime;
1919

@@ -63,8 +63,7 @@ export class DotNetFunction extends lambda.Function {
6363
// Find aws-lambda-tools-defaults.json in project directory
6464
const lambdaToolsDefaults = getLambdaToolsDefaults(projectDir);
6565

66-
// Resolve Lambda runtime from properties, aws-lambda-tools-defaults.json or default to PROVIDED_AL2
67-
66+
// Resolve Lambda runtime from properties, aws-lambda-tools-defaults.json or default to DOTNET_8
6867
let runtime = props.runtime;
6968
if (!runtime) {
7069
const toolsRuntime = lambdaToolsDefaults?.['function-runtime'] as
@@ -80,7 +79,7 @@ export class DotNetFunction extends lambda.Function {
8079
: lambda.RuntimeFamily.OTHER;
8180
runtime = new lambda.Runtime(toolsRuntime, family);
8281
} else {
83-
runtime = lambda.Runtime.DOTNET_6;
82+
runtime = lambda.Runtime.DOTNET_8;
8483
}
8584
}
8685
if (

test/integ.function-aot.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class TestStack extends Stack {
1616

1717
const fn = new dotnet.DotNetFunction(this, 'lambda-handler', {
1818
projectDir: 'lambda-handler-aot',
19-
runtime: lambda.Runtime.PROVIDED_AL2,
19+
runtime: lambda.Runtime.PROVIDED_AL2023,
2020
bundling: {
2121
msbuildParameters: ['/p:PublishAot=true'],
2222
},
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"version":"31.0.0"}
1+
{"version":"36.0.0"}

test/integ.function-aot.ts.snapshot/integ-lambda-dotnet-function.assets.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
{
2-
"version": "31.0.0",
2+
"version": "36.0.0",
33
"files": {
4-
"3afcdc2564c22c22f2e8c7c164709f382276a3bb3c0e5707193d96f9eb2be352": {
4+
"c8d221fd3a68e77e0bb5a1a3a20632d82241bd8594240ed97a0c270b29d76fe1": {
55
"source": {
6-
"path": "asset.3afcdc2564c22c22f2e8c7c164709f382276a3bb3c0e5707193d96f9eb2be352",
7-
"packaging": "zip"
6+
"path": "asset.c8d221fd3a68e77e0bb5a1a3a20632d82241bd8594240ed97a0c270b29d76fe1.zip",
7+
"packaging": "file"
88
},
99
"destinations": {
1010
"current_account-current_region": {
1111
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
12-
"objectKey": "3afcdc2564c22c22f2e8c7c164709f382276a3bb3c0e5707193d96f9eb2be352.zip",
12+
"objectKey": "c8d221fd3a68e77e0bb5a1a3a20632d82241bd8594240ed97a0c270b29d76fe1.zip",
1313
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
1414
}
1515
}
1616
},
17-
"8b32c683122f98f83f1bc6a677493b2056a3ed55fb6e2ec6870cb08a464fc142": {
17+
"3cecd6ad73d70bef6c99834469a796514b0f55ac40e537f945370fd2fc4b597d": {
1818
"source": {
1919
"path": "integ-lambda-dotnet-function.template.json",
2020
"packaging": "file"
2121
},
2222
"destinations": {
2323
"current_account-current_region": {
2424
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
25-
"objectKey": "8b32c683122f98f83f1bc6a677493b2056a3ed55fb6e2ec6870cb08a464fc142.json",
25+
"objectKey": "3cecd6ad73d70bef6c99834469a796514b0f55ac40e537f945370fd2fc4b597d.json",
2626
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
2727
}
2828
}

test/integ.function-aot.ts.snapshot/integ-lambda-dotnet-function.template.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,23 @@
3434
"lambdahandler909F9205": {
3535
"Type": "AWS::Lambda::Function",
3636
"Properties": {
37+
"Architectures": [
38+
"x86_64"
39+
],
3740
"Code": {
3841
"S3Bucket": {
3942
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
4043
},
41-
"S3Key": "3afcdc2564c22c22f2e8c7c164709f382276a3bb3c0e5707193d96f9eb2be352.zip"
44+
"S3Key": "c8d221fd3a68e77e0bb5a1a3a20632d82241bd8594240ed97a0c270b29d76fe1.zip"
4245
},
46+
"Handler": "LambdaHandler",
4347
"Role": {
4448
"Fn::GetAtt": [
4549
"lambdahandlerServiceRoleA08D1FE8",
4650
"Arn"
4751
]
4852
},
49-
"Architectures": [
50-
"x86_64"
51-
],
52-
"Handler": "LambdaHandler",
53-
"Runtime": "provided.al2"
53+
"Runtime": "provided.al2023"
5454
},
5555
"DependsOn": [
5656
"lambdahandlerServiceRoleA08D1FE8"

test/integ.function-aot.ts.snapshot/integ.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "31.0.0",
2+
"version": "36.0.0",
33
"testCases": {
44
"lambda-dotnet-function/DefaultTest": {
55
"stacks": [

test/integ.function-aot.ts.snapshot/lambdadotnetfunctionDefaultTestDeployAssert02A806B6.assets.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
{
2-
"version": "31.0.0",
2+
"version": "36.0.0",
33
"files": {
4-
"ae370e1010629b78f494346f49ceef3ab2875718f20e6c808114e6aa770c7bf3": {
4+
"ac51674cf5325b7a0e5444d6b7c1f88607c16a031b852bd51c375ac8c5c4fce5": {
55
"source": {
6-
"path": "asset.ae370e1010629b78f494346f49ceef3ab2875718f20e6c808114e6aa770c7bf3.bundle",
6+
"path": "asset.ac51674cf5325b7a0e5444d6b7c1f88607c16a031b852bd51c375ac8c5c4fce5.bundle",
77
"packaging": "zip"
88
},
99
"destinations": {
1010
"current_account-current_region": {
1111
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
12-
"objectKey": "ae370e1010629b78f494346f49ceef3ab2875718f20e6c808114e6aa770c7bf3.zip",
12+
"objectKey": "ac51674cf5325b7a0e5444d6b7c1f88607c16a031b852bd51c375ac8c5c4fce5.zip",
1313
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
1414
}
1515
}
1616
},
17-
"13f2f2564450a40bf43d77018823605bcbfa7fdf49245d56c5e516d8d3192e9f": {
17+
"c7af404054ae80514e6e730ee4f0244146e414182b036979f382594c6632acbd": {
1818
"source": {
1919
"path": "lambdadotnetfunctionDefaultTestDeployAssert02A806B6.template.json",
2020
"packaging": "file"
2121
},
2222
"destinations": {
2323
"current_account-current_region": {
2424
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
25-
"objectKey": "13f2f2564450a40bf43d77018823605bcbfa7fdf49245d56c5e516d8d3192e9f.json",
25+
"objectKey": "c7af404054ae80514e6e730ee4f0244146e414182b036979f382594c6632acbd.json",
2626
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
2727
}
2828
}

test/integ.function-aot.ts.snapshot/lambdadotnetfunctionDefaultTestDeployAssert02A806B6.template.json

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,20 @@
1414
"expected": "{\"$ObjectLike\":{\"Payload\":\"\\\"Ok\\\"\"}}",
1515
"parameters": {
1616
"FunctionName": {
17-
"Fn::ImportValue": "integ-lambda-dotnet-function:ExportsOutputReflambdahandler909F920591EA4974"
17+
"Fn::Join": [
18+
"",
19+
[
20+
"\"",
21+
{
22+
"Fn::ImportValue": "integ-lambda-dotnet-function:ExportsOutputReflambdahandler909F920591EA4974"
23+
},
24+
"\""
25+
]
26+
]
1827
}
1928
},
2029
"flattenResponse": "false",
21-
"salt": "1701536823208"
30+
"salt": "1726517775923"
2231
},
2332
"UpdateReplacePolicy": "Delete",
2433
"DeletionPolicy": "Delete"
@@ -113,12 +122,12 @@
113122
"SingletonFunction1488541a7b23466481b69b4408076b81HandlerCD40AE9F": {
114123
"Type": "AWS::Lambda::Function",
115124
"Properties": {
116-
"Runtime": "nodejs14.x",
125+
"Runtime": "nodejs18.x",
117126
"Code": {
118127
"S3Bucket": {
119128
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
120129
},
121-
"S3Key": "ae370e1010629b78f494346f49ceef3ab2875718f20e6c808114e6aa770c7bf3.zip"
130+
"S3Key": "ac51674cf5325b7a0e5444d6b7c1f88607c16a031b852bd51c375ac8c5c4fce5.zip"
122131
},
123132
"Timeout": 120,
124133
"Handler": "index.handler",

test/integ.function-aot.ts.snapshot/manifest.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "35.0.0",
2+
"version": "36.0.24",
33
"artifacts": {
44
"integ-lambda-dotnet-function.assets": {
55
"type": "cdk:asset-manifest",
@@ -14,10 +14,11 @@
1414
"environment": "aws://unknown-account/unknown-region",
1515
"properties": {
1616
"templateFile": "integ-lambda-dotnet-function.template.json",
17+
"terminationProtection": false,
1718
"validateOnSynth": false,
1819
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}",
1920
"cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}",
20-
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/8b32c683122f98f83f1bc6a677493b2056a3ed55fb6e2ec6870cb08a464fc142.json",
21+
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/3cecd6ad73d70bef6c99834469a796514b0f55ac40e537f945370fd2fc4b597d.json",
2122
"requiresBootstrapStackVersion": 6,
2223
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
2324
"additionalDependencies": [
@@ -85,10 +86,11 @@
8586
"environment": "aws://unknown-account/unknown-region",
8687
"properties": {
8788
"templateFile": "lambdadotnetfunctionDefaultTestDeployAssert02A806B6.template.json",
89+
"terminationProtection": false,
8890
"validateOnSynth": false,
8991
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}",
9092
"cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}",
91-
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/13f2f2564450a40bf43d77018823605bcbfa7fdf49245d56c5e516d8d3192e9f.json",
93+
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/c7af404054ae80514e6e730ee4f0244146e414182b036979f382594c6632acbd.json",
9294
"requiresBootstrapStackVersion": 6,
9395
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
9496
"additionalDependencies": [

0 commit comments

Comments
 (0)