1"use strict";(self.webpackChunkcloudanix_dotcom_docs_temp=self.webpackChunkcloudanix_dotcom_docs_temp||[]).push([["102844"],{711570(e,n,t){t.r(n),t.d(n,{metadata:()=>i,default:()=>u,frontMatter:()=>s,contentTitle:()=>a,toc:()=>c,assets:()=>d});var i=JSON.parse('{"id":"aws/audit/lambdamonitoring/rules/deprecated_runtime_remediation","title":"Deprecated Runtime Remediation","description":"Step-by-step remediation instructions for AWS Lambda deprecated runtime misconfiguration using Console, CLI, Python, Terraform.","source":"@site/docs/aws/audit/lambdamonitoring/rules/deprecated_runtime_remediation.mdx","sourceDirName":"aws/audit/lambdamonitoring/rules","slug":"/aws/audit/lambdamonitoring/rules/deprecated_runtime_remediation","permalink":"/docs/aws/audit/lambdamonitoring/rules/deprecated_runtime_remediation","draft":false,"unlisted":false,"editUrl":"https://github.com/Cloudanix/cloudanix-dotcom-docs/edit/main/docs/aws/audit/lambdamonitoring/rules/deprecated_runtime_remediation.mdx","tags":[],"version":"current","frontMatter":{"title":"Deprecated Runtime Remediation","sidebar_label":"Deprecated Runtime Remediation","description":"Step-by-step remediation instructions for AWS Lambda deprecated runtime misconfiguration using Console, CLI, Python, Terraform."},"sidebar":"docsSidebar","previous":{"title":"Lambda Functions Should Not Use Deprecated Versions","permalink":"/docs/aws/audit/lambdamonitoring/rules/deprecated_runtime"},"next":{"title":"AWS Lambda Should Have DLQ Configured","permalink":"/docs/aws/audit/lambdamonitoring/rules/dlq_configured"}}'),o=t(474848),r=t(28453);let s={title:"Deprecated Runtime Remediation",sidebar_label:"Deprecated Runtime Remediation",description:"Step-by-step remediation instructions for AWS Lambda deprecated runtime misconfiguration using Console, CLI, Python, Terraform."},a,d={},c=[{value:"Triage and Remediation",id:"triage-and-remediation",level:3},{value:"Remediation",id:"remediation",level:3}];function l(e){let n={code:"code",h1:"h1",h3:"h3",li:"li",ol:"ol",p:"p",pre:"pre",ul:"ul",...(0,r.R)(),...e.components},{Accordion:t,AccordionGroup:i,Tab:s,Tabs:a}=n;return t||h("Accordion",!0),i||h("AccordionGroup",!0),s||h("Tab",!0),a||h("Tabs",!0),(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.h3,{id:"triage-and-remediation",children:"Triage and Remediation"}),"\n",(0,o.jsx)(a,{children:(0,o.jsxs)(s,{title:"Remediation",children:[(0,o.jsx)(n.h3,{id:"remediation",children:"Remediation"}),(0,o.jsxs)(i,{children:[(0,o.jsxs)(t,{title:"Using Console",defaultOpen:"true",children:[(0,o.jsx)(n.p,{children:"To remediate the misconfiguration of Lambda Functions using deprecated versions in AWS, follow these steps:"}),(0,o.jsxs)(n.ol,{children:["\n",(0,o.jsx)(n.li,{children:"Login to the AWS Management Console."}),"\n",(0,o.jsx)(n.li,{children:"Go to the AWS Lambda service."}),"\n",(0,o.jsx)(n.li,{children:"Select the Lambda function that is using a deprecated version."}),"\n",(0,o.jsx)(n.li,{children:'Click on the "Configuration" tab.'}),"\n",(0,o.jsx)(n.li,{children:'In the "Runtime settings" section, select the latest version of the runtime that is available. For example, if the function is using Node.js 8.10, select Node.js 14.x.'}),"\n",(0,o.jsx)(n.li,{children:'Click on the "Save" button to save the changes.'}),"\n",(0,o.jsx)(n.li,{children:"Test the function to ensure that it is working properly with the updated runtime version."}),"\n"]}),(0,o.jsx)(n.p,{children:"By following these steps, you have successfully remediated the misconfiguration of Lambda Functions using deprecated versions in AWS."}),(0,o.jsx)(n.h1,{id:""})]}),(0,o.jsxs)(t,{title:"Using CLI",children:[(0,o.jsx)(n.p,{children:"To remediate the Lambda Functions Should Not Use Deprecated Versions misconfiguration in AWS using AWS CLI, follow these steps:"}),(0,o.jsxs)(n.ol,{children:["\n",(0,o.jsxs)(n.li,{children:["\n",(0,o.jsx)(n.p,{children:"Open your terminal and make sure you have the AWS CLI installed."}),"\n"]}),"\n",(0,o.jsxs)(n.li,{children:["\n",(0,o.jsx)(n.p,{children:"Run the following command to list all the Lambda functions in your AW
1S account:"}),"\n"]}),"\n"]}),(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{children:"aws lambda list-functions\n"})}),(0,o.jsxs)(n.ol,{start:"3",children:["\n",(0,o.jsxs)(n.li,{children:["\n",(0,o.jsx)(n.p,{children:"Identify the Lambda functions that are using deprecated versions."}),"\n"]}),"\n",(0,o.jsxs)(n.li,{children:["\n",(0,o.jsx)(n.p,{children:"Run the following command to update the runtime of the Lambda function to a non-deprecated version:"}),"\n"]}),"\n"]}),(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{children:"aws lambda update-function-configuration --function-name <function-name> --runtime <runtime>\n"})}),(0,o.jsxs)(n.p,{children:["Replace ",(0,o.jsx)(n.code,{children:"<function-name>"})," with the name of the Lambda function that you want to update, and ",(0,o.jsx)(n.code,{children:"<runtime>"})," with the non-deprecated runtime version that you want to use."]}),(0,o.jsxs)(n.ol,{start:"5",children:["\n",(0,o.jsxs)(n.li,{children:["\n",(0,o.jsx)(n.p,{children:"Repeat steps 4 and 5 for all the Lambda functions that are using deprecated versions."}),"\n"]}),"\n",(0,o.jsxs)(n.li,{children:["\n",(0,o.jsx)(n.p,{children:"Verify that all the Lambda functions are now using non-deprecated versions by running the following command:"}),"\n"]}),"\n"]}),(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{children:"aws lambda list-functions --query 'Functions[*].Runtime'\n"})}),(0,o.jsx)(n.p,{children:"This command will return a list of all the Lambda functions and their respective runtimes. Make sure that all the runtimes are non-deprecated versions."}),(0,o.jsx)(n.p,{children:"By following these steps, you can remediate the Lambda Functions Should Not Use Deprecated Versions misconfiguration in AWS using AWS CLI."})]}),(0,o.jsxs)(t,{title:"Using Python",children:[(0,o.jsx)(n.p,{children:'To remediate the misconfiguration "Lambda Functions Should Not Use Deprecated Versions" in AWS using Python, follow the below steps:'}),(0,o.jsxs)(n.ol,{children:["\n",(0,o.jsxs)(n.li,{children:["\n",(0,o.jsx)(n.p,{children:"Login to the AWS Management Console and navigate to the Lambda service."}),"\n"]}),"\n",(0,o.jsxs)(n.li,{children:["\n",(0,o.jsx)(n.p,{children:"Select the Lambda function that is using a deprecated version."}),"\n"]}),"\n",(0,o.jsxs)(n.li,{children:["\n",(0,o.jsx)(n.p,{children:'Click on the "Configuration" tab and scroll down to the "Runtime settings" section.'}),"\n"]}),"\n",(0,o.jsxs)(n.li,{children:["\n",(0,o.jsx)(n.p,{children:"Verify the runtime version of the function. If it is using a deprecated version, then it needs to be updated."}),"\n"]}),"\n",(0,o.jsxs)(n.li,{children:["\n",(0,o.jsx)(n.p,{children:"Update the runtime version of the Lambda function to the latest version supported by AWS. You can refer to the AWS documentation to find the latest supported version."}),"\n"]}),"\n",(0,o.jsxs)(n.li,{children:["\n",(0,o.jsx)(n.p,{children:'Once the update is complete, click on the "Save" button to save the changes.'}),"\n"]}),"\n",(0,o.jsxs)(n.li,{children:["\n",(0,o.jsx)(n.p,{children:"Test the updated Lambda function to ensure that it is functioning as expected."}),"\n"]}),"\n",(0,o.jsxs)(n.li,{children:["\n",(0,o.jsx)(n.p,{children:"Finally, it is recommended to regularly monitor the runtime versions of your Lambda functions and update them as needed to ensure that they are not using any deprecated versions."}),"\n"]}),"\n"]}),(0,o.jsx)(n.p,{children:"In Python, you can use the AWS SDK boto3 to programmatically update the runtime version of your Lambda function. Here's an example code snippet:"}),(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{children:'import boto3\n\n# Replace <function_name> and <new_runtime> with your function name and the new runtime version respectively\nfunction_name = "<function_name>"\nnew_runtime = "<new_runtime>"\n\n# Create a Lambda client object\nlambda_client = boto3.client(\'lambda\')\n\n# Update the runtime version of the function\nresponse = lambda_client.update_function_configuration(\n FunctionName=function_name,\n Runtime=new_runtime\n)\n\n# Print the response\nprint(response)\n'})})]}),(0,o.jsxs)(t,{title:"Using Terraform",children:[(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-hcl",children:'resource "aws_lambda_function" "EXISTING_FUNCTION_NAME" {\n function_name = "EXISTING_FUNCTION_NAME"\n\n # Replace with your existing settings\n role = aws_iam_role.LAMBDA_EXECUTION_ROLE.arn\n handler = "INDEX.HANDLER"\n filename = "PACKAGE_ZIP_PATH"\n source_code_hash = FILEBASE64SHA256_OF_PACKAGE\n\n # IMPORTANT: update this to a currently supported runtime\n # Examples (confirm support in AWS docs before using):\n # "nodejs20.x", "python3.12", "java21", "ruby3.3", "dotnet8", "go1.x"\n runtime = "NEW_SUPPORTED_RUNTIME"\n}\n'})}),(0,o.jsx)(n.p,{children:"Replace:"}),(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"EXISTING_FUNCTION_NAME"})," with your Lambda function name."]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"LAMBDA_EXECUTION_ROLE"})," with the IAM role resource name you use."]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"INDEX.HANDLER"}
1),", ",(0,o.jsx)(n.code,{children:"PACKAGE_ZIP_PATH"}),", ",(0,o.jsx)(n.code,{children:"FILEBASE64SHA256_OF_PACKAGE"})," with your existing values."]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"NEW_SUPPORTED_RUNTIME"})," with a supported runtime compatible with your code."]}),"\n"]}),(0,o.jsxs)(n.p,{children:["Note: Changing ",(0,o.jsx)(n.code,{children:"runtime"})," updates the function configuration in place (no resource replacement), but it can break your function if the code is not compatible; test in non-production first."]}),(0,o.jsxs)(n.p,{children:["Verification: ",(0,o.jsx)(n.code,{children:"terraform plan"})," should show an in-place update for ",(0,o.jsx)(n.code,{children:"aws_lambda_function.EXISTING_FUNCTION_NAME"})," with ",(0,o.jsx)(n.code,{children:"runtime"})," changing from the deprecated value to ",(0,o.jsx)(n.code,{children:'"NEW_SUPPORTED_RUNTIME"'}),"."]})]})]})]})})]})}function u(e={}){let{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(l,{...e})}):l(e)}function h(e,n){throw Error("Expected "+(n?"component":"object")+" `"+e+"` to be defined: you likely forgot to import, pass, or provide it.")}},28453(e,n,t){t.d(n,{R:()=>s,x:()=>a});var i=t(296540);let o={},r=i.createContext(o);function s(e){let n=i.useContext(r);return i.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:s(e.components),i.createElement(r.Provider,{value:n},e.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.