From 74335f63b7be81ede07e1ae2e24e7f59ed44beef Mon Sep 17 00:00:00 2001 From: Calvin Combs <66279577+comcalvi@users.noreply.github.com> Date: Tue, 20 Feb 2024 09:38:44 -0800 Subject: [PATCH] feat(lambda): adding .net 8 (dotnet8) lambda runtime support (#29178) *Co-authored by*: @Beau-Gosse-dev ### Issue # (if applicable) ### Reason for this change Lambda is launching dotnet8 ### Description of changes new runtime added ### Description of how you validated changes integ tested ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- .../aws-lambda/test/dotnet-handler/handler.cs | 16 ++ .../handler.cs | 16 ++ ...-cdk-lambda-runtime-management.assets.json | 32 +++ ...dk-lambda-runtime-management.template.json | 91 ++++++++ .../test/integ.runtimes.js.snapshot/cdk.out | 1 + .../integ.runtimes.js.snapshot/integ.json | 12 + ...efaultTestDeployAssertDE680AF3.assets.json | 19 ++ ...aultTestDeployAssertDE680AF3.template.json | 36 +++ .../integ.runtimes.js.snapshot/manifest.json | 119 ++++++++++ .../test/integ.runtimes.js.snapshot/tree.json | 221 ++++++++++++++++++ .../test/aws-lambda/test/integ.runtimes.ts | 17 ++ .../aws-cdk-lib/aws-lambda/lib/runtime.ts | 5 + 12 files changed, 585 insertions(+) create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/dotnet-handler/handler.cs create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtimes.js.snapshot/asset.a328343cb12aa16bf2c12bfa98f28509923cf8a0e9771cccbbe967d9e15c08f6/handler.cs create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtimes.js.snapshot/aws-cdk-lambda-runtime-management.assets.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtimes.js.snapshot/aws-cdk-lambda-runtime-management.template.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtimes.js.snapshot/cdk.out create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtimes.js.snapshot/integ.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtimes.js.snapshot/lambdaruntimemanagementDefaultTestDeployAssertDE680AF3.assets.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtimes.js.snapshot/lambdaruntimemanagementDefaultTestDeployAssertDE680AF3.template.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtimes.js.snapshot/manifest.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtimes.js.snapshot/tree.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtimes.ts diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/dotnet-handler/handler.cs b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/dotnet-handler/handler.cs new file mode 100644 index 0000000000000..5151f1ca92df6 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/dotnet-handler/handler.cs @@ -0,0 +1,16 @@ +[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.SystemTextJson.DefaultLambdaJsonSerializer))] + +namespace Handler; + +public class Function { + public Function() {} + + public async Task Handler(APIGatewayProxyRequest request) { + var id = request.PathParameters["id"]; + + return new APIGatewayProxyResponse { + StatusCode = (int)HttpStatusCode.OK, + Body = JsonSerializer.Serialize(databaseRecord) + }; + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtimes.js.snapshot/asset.a328343cb12aa16bf2c12bfa98f28509923cf8a0e9771cccbbe967d9e15c08f6/handler.cs b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtimes.js.snapshot/asset.a328343cb12aa16bf2c12bfa98f28509923cf8a0e9771cccbbe967d9e15c08f6/handler.cs new file mode 100644 index 0000000000000..5151f1ca92df6 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtimes.js.snapshot/asset.a328343cb12aa16bf2c12bfa98f28509923cf8a0e9771cccbbe967d9e15c08f6/handler.cs @@ -0,0 +1,16 @@ +[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.SystemTextJson.DefaultLambdaJsonSerializer))] + +namespace Handler; + +public class Function { + public Function() {} + + public async Task Handler(APIGatewayProxyRequest request) { + var id = request.PathParameters["id"]; + + return new APIGatewayProxyResponse { + StatusCode = (int)HttpStatusCode.OK, + Body = JsonSerializer.Serialize(databaseRecord) + }; + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtimes.js.snapshot/aws-cdk-lambda-runtime-management.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtimes.js.snapshot/aws-cdk-lambda-runtime-management.assets.json new file mode 100644 index 0000000000000..3513cd2e82125 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtimes.js.snapshot/aws-cdk-lambda-runtime-management.assets.json @@ -0,0 +1,32 @@ +{ + "version": "36.0.0", + "files": { + "a328343cb12aa16bf2c12bfa98f28509923cf8a0e9771cccbbe967d9e15c08f6": { + "source": { + "path": "asset.a328343cb12aa16bf2c12bfa98f28509923cf8a0e9771cccbbe967d9e15c08f6", + "packaging": "zip" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "a328343cb12aa16bf2c12bfa98f28509923cf8a0e9771cccbbe967d9e15c08f6.zip", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + }, + "0b5d2fcad307870038cfd281c114626e26399f8e8640f09d0012b0b142d45dad": { + "source": { + "path": "aws-cdk-lambda-runtime-management.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "0b5d2fcad307870038cfd281c114626e26399f8e8640f09d0012b0b142d45dad.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtimes.js.snapshot/aws-cdk-lambda-runtime-management.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtimes.js.snapshot/aws-cdk-lambda-runtime-management.template.json new file mode 100644 index 0000000000000..0f82715b2a545 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtimes.js.snapshot/aws-cdk-lambda-runtime-management.template.json @@ -0,0 +1,91 @@ +{ + "Resources": { + "LambdaServiceRoleA8ED4D3B": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "LambdaD247545B": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "S3Key": "a328343cb12aa16bf2c12bfa98f28509923cf8a0e9771cccbbe967d9e15c08f6.zip" + }, + "Handler": "Handler", + "Role": { + "Fn::GetAtt": [ + "LambdaServiceRoleA8ED4D3B", + "Arn" + ] + }, + "Runtime": "dotnet8" + }, + "DependsOn": [ + "LambdaServiceRoleA8ED4D3B" + ] + } + }, + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtimes.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtimes.js.snapshot/cdk.out new file mode 100644 index 0000000000000..1f0068d32659a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtimes.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"36.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtimes.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtimes.js.snapshot/integ.json new file mode 100644 index 0000000000000..3027def44fce1 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtimes.js.snapshot/integ.json @@ -0,0 +1,12 @@ +{ + "version": "36.0.0", + "testCases": { + "lambda-runtime-management/DefaultTest": { + "stacks": [ + "aws-cdk-lambda-runtime-management" + ], + "assertionStack": "lambda-runtime-management/DefaultTest/DeployAssert", + "assertionStackName": "lambdaruntimemanagementDefaultTestDeployAssertDE680AF3" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtimes.js.snapshot/lambdaruntimemanagementDefaultTestDeployAssertDE680AF3.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtimes.js.snapshot/lambdaruntimemanagementDefaultTestDeployAssertDE680AF3.assets.json new file mode 100644 index 0000000000000..02ab365f135aa --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtimes.js.snapshot/lambdaruntimemanagementDefaultTestDeployAssertDE680AF3.assets.json @@ -0,0 +1,19 @@ +{ + "version": "36.0.0", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "lambdaruntimemanagementDefaultTestDeployAssertDE680AF3.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtimes.js.snapshot/lambdaruntimemanagementDefaultTestDeployAssertDE680AF3.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtimes.js.snapshot/lambdaruntimemanagementDefaultTestDeployAssertDE680AF3.template.json new file mode 100644 index 0000000000000..ad9d0fb73d1dd --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtimes.js.snapshot/lambdaruntimemanagementDefaultTestDeployAssertDE680AF3.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtimes.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtimes.js.snapshot/manifest.json new file mode 100644 index 0000000000000..98bf563db0db5 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtimes.js.snapshot/manifest.json @@ -0,0 +1,119 @@ +{ + "version": "36.0.0", + "artifacts": { + "aws-cdk-lambda-runtime-management.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "aws-cdk-lambda-runtime-management.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "aws-cdk-lambda-runtime-management": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "aws-cdk-lambda-runtime-management.template.json", + "terminationProtection": false, + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/0b5d2fcad307870038cfd281c114626e26399f8e8640f09d0012b0b142d45dad.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "aws-cdk-lambda-runtime-management.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "aws-cdk-lambda-runtime-management.assets" + ], + "metadata": { + "/aws-cdk-lambda-runtime-management/Lambda/ServiceRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "LambdaServiceRoleA8ED4D3B" + } + ], + "/aws-cdk-lambda-runtime-management/Lambda/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "LambdaD247545B" + } + ], + "/aws-cdk-lambda-runtime-management/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/aws-cdk-lambda-runtime-management/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "aws-cdk-lambda-runtime-management" + }, + "lambdaruntimemanagementDefaultTestDeployAssertDE680AF3.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "lambdaruntimemanagementDefaultTestDeployAssertDE680AF3.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "lambdaruntimemanagementDefaultTestDeployAssertDE680AF3": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "lambdaruntimemanagementDefaultTestDeployAssertDE680AF3.template.json", + "terminationProtection": false, + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "lambdaruntimemanagementDefaultTestDeployAssertDE680AF3.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "lambdaruntimemanagementDefaultTestDeployAssertDE680AF3.assets" + ], + "metadata": { + "/lambda-runtime-management/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/lambda-runtime-management/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "lambda-runtime-management/DefaultTest/DeployAssert" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtimes.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtimes.js.snapshot/tree.json new file mode 100644 index 0000000000000..4e2af82a8510a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtimes.js.snapshot/tree.json @@ -0,0 +1,221 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "aws-cdk-lambda-runtime-management": { + "id": "aws-cdk-lambda-runtime-management", + "path": "aws-cdk-lambda-runtime-management", + "children": { + "Lambda": { + "id": "Lambda", + "path": "aws-cdk-lambda-runtime-management/Lambda", + "children": { + "ServiceRole": { + "id": "ServiceRole", + "path": "aws-cdk-lambda-runtime-management/Lambda/ServiceRole", + "children": { + "ImportServiceRole": { + "id": "ImportServiceRole", + "path": "aws-cdk-lambda-runtime-management/Lambda/ServiceRole/ImportServiceRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "aws-cdk-lambda-runtime-management/Lambda/ServiceRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "managedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Code": { + "id": "Code", + "path": "aws-cdk-lambda-runtime-management/Lambda/Code", + "children": { + "Stage": { + "id": "Stage", + "path": "aws-cdk-lambda-runtime-management/Lambda/Code/Stage", + "constructInfo": { + "fqn": "aws-cdk-lib.AssetStaging", + "version": "0.0.0" + } + }, + "AssetBucket": { + "id": "AssetBucket", + "path": "aws-cdk-lambda-runtime-management/Lambda/Code/AssetBucket", + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.BucketBase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3_assets.Asset", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "aws-cdk-lambda-runtime-management/Lambda/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Lambda::Function", + "aws:cdk:cloudformation:props": { + "code": { + "s3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "s3Key": "a328343cb12aa16bf2c12bfa98f28509923cf8a0e9771cccbbe967d9e15c08f6.zip" + }, + "handler": "Handler", + "role": { + "Fn::GetAtt": [ + "LambdaServiceRoleA8ED4D3B", + "Arn" + ] + }, + "runtime": "dotnet8" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_lambda.CfnFunction", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_lambda.Function", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "aws-cdk-lambda-runtime-management/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "aws-cdk-lambda-runtime-management/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "lambda-runtime-management": { + "id": "lambda-runtime-management", + "path": "lambda-runtime-management", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "lambda-runtime-management/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "lambda-runtime-management/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "lambda-runtime-management/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "lambda-runtime-management/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "lambda-runtime-management/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", + "version": "0.0.0" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.App", + "version": "0.0.0" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtimes.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtimes.ts new file mode 100644 index 0000000000000..d5887867c6b74 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtimes.ts @@ -0,0 +1,17 @@ +import { App, Stack } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import { Code, Function, Runtime } from 'aws-cdk-lib/aws-lambda'; + +const app = new App(); + +const stack = new Stack(app, 'aws-cdk-lambda-runtime-management'); + +new Function(stack, 'Lambda', { + code: Code.fromAsset('dotnet-handler'), + handler: 'Handler', + runtime: Runtime.DOTNET_8, +}); + +new integ.IntegTest(app, 'lambda-runtime-management', { + testCases: [stack], +}); diff --git a/packages/aws-cdk-lib/aws-lambda/lib/runtime.ts b/packages/aws-cdk-lib/aws-lambda/lib/runtime.ts index 1c05e74ec7957..1cee8ac05823d 100644 --- a/packages/aws-cdk-lib/aws-lambda/lib/runtime.ts +++ b/packages/aws-cdk-lib/aws-lambda/lib/runtime.ts @@ -226,6 +226,11 @@ export class Runtime { */ public static readonly DOTNET_6 = new Runtime('dotnet6', RuntimeFamily.DOTNET_CORE); + /** + * The .NET 8 runtime (dotnet8) + */ + public static readonly DOTNET_8 = new Runtime('dotnet8', RuntimeFamily.DOTNET_CORE); + /** * The .NET Core 1.0 runtime (dotnetcore1.0) * @deprecated Legacy runtime no longer supported by AWS Lambda. Migrate to the latest .NET Core runtime.