Skip to content

Commit

Permalink
feat(lambda): add python 3.12 runtime (#27967)
Browse files Browse the repository at this point in the history
Adds a Python 3.12 runtime to Lambda.



----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
mikewrighton authored and Mike Wrighton committed Nov 13, 2023
1 parent 5fbc488 commit 505907a
Show file tree
Hide file tree
Showing 9 changed files with 33,691 additions and 8 deletions.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,56 @@
"PYTHON310ServiceRole65985CC8"
]
},
"PYTHON312ServiceRoleBEB03378": {
"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"
]
]
}
]
}
},
"PYTHON3127B62731D": {
"Type": "AWS::Lambda::Function",
"Properties": {
"Code": {
"ZipFile": "def handler(event, context):\n return \"success\""
},
"Handler": "index.handler",
"Role": {
"Fn::GetAtt": [
"PYTHON312ServiceRoleBEB03378",
"Arn"
]
},
"Runtime": "python3.12"
},
"DependsOn": [
"PYTHON312ServiceRoleBEB03378"
]
},
"NODEJS14XServiceRole4523ECDB": {
"Type": "AWS::IAM::Role",
"Properties": {
Expand Down Expand Up @@ -422,6 +472,11 @@
"Ref": "PYTHON310431C418B"
}
},
"PYTHON312functionName": {
"Value": {
"Ref": "PYTHON3127B62731D"
}
},
"NODEJS14XfunctionName": {
"Value": {
"Ref": "NODEJS14X930214A3"
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ const python310 = new Function(stack, 'PYTHON_3_10', {
});
new CfnOutput(stack, 'PYTHON_3_10-functionName', { value: python310.functionName });

const python312 = new Function(stack, 'PYTHON_3_12', {
code: new InlineCode('def handler(event, context):\n return "success"'),
handler: 'index.handler',
runtime: Runtime.PYTHON_3_12,
});
new CfnOutput(stack, 'PYTHON_3_12-functionName', { value: python312.functionName });

const node14xfn = new Function(stack, 'NODEJS_14_X', {
code: new InlineCode('exports.handler = async function(event) { return "success" }'),
handler: 'index.handler',
Expand Down
8 changes: 8 additions & 0 deletions packages/aws-cdk-lib/aws-lambda/lib/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,14 @@ export class Runtime {
supportsCodeGuruProfiling: true,
});

/**
* The Python 3.12 runtime (python3.12)
*/
public static readonly PYTHON_3_12 = new Runtime('python3.12', RuntimeFamily.PYTHON, {
supportsInlineCode: true,
supportsCodeGuruProfiling: true,
});

/**
* The Java 8 runtime (java8)
*/
Expand Down

0 comments on commit 505907a

Please sign in to comment.