[{"data":1,"prerenderedAt":72},["ShallowReactive",2],{"content-svc-lambda-guides-cost-optimization-2-graviton":3},{"markdown":4,"frontMatterAttributes":5,"bodyRaw":8,"menu":9,"menuType":64,"isCollapseableMenu":12,"nextDocItem":26,"previousDocItem":14,"contributorPaths":65,"contentName":71,"slug":25,"readingTime":22},"\u003Cp>AWS Graviton2 is a second generation of custom built 64-bit ARM processors, designed to provide better cost and performance. For Lambda functions you can see up to \u003Ca href=\"https:\u002F\u002Faws.amazon.com\u002Fblogs\u002Faws\u002Faws-lambda-functions-powered-by-aws-graviton2-processor-run-your-functions-on-arm-and-get-up-to-34-better-price-performance\u002F\">34% better price performance\u003C\u002Fa> by switching to Graviton2. \u003C\u002Fp>\n\u003Cp>Switching to this arm64 based architecture is as easy as toggling the radio button in Lambda console to “arm64” from “x86_64”. \u003C\u002Fp>\n\u003Cimg src=\"\u002Fassets\u002Fexternal\u002Fservice\u002Flambda\u002Fguides\u002Fcost-optimization\u002Fassets\u002Fgraviton-01.jpg\"\u002F>\n\n\u003Cp>You can also use AWS CLI to change the architecture:\u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-sh\">aws lambda create-function \\\n    --function-name MyArmFunction \\\n    --runtime nodejs18.x \\\n    --architectures arm64 \\\n    --memory-size 512 \\\n    --zip-file fileb:\u002F\u002FMyArmFunction.zip \\\n    --handler lambda.handler \\\n    --role arn:aws:iam::123456789012:role\u002Fservice-role\u002FMyArmFunction-role\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>Start by identifying workloads that will benefit most from these gains. Many runtimes already support Graviton2 today (eg. Node.js, Python, Java, .NET) and you can switch your functions with minimal to no changes. A common approach to comparing potential gains is to run your function side by side on both x86_64 and Graviton2 and to analyze cost\u002Fperformance results using the \u003Ca href=\"https:\u002F\u002Fdocs.aws.amazon.com\u002Flambda\u002Flatest\u002Foperatorguide\u002Fprofile-functions.html\">Lambda Power Tuning\u003C\u002Fa> tool. \u003C\u002Fp>\n\u003Cimg src=\"\u002Fassets\u002Fexternal\u002Fservice\u002Flambda\u002Fguides\u002Fcost-optimization\u002Fassets\u002Fgraviton-02.jpg\"\u002F>\n\n\u003Cp>In the sample Lambda Power Tuning report above, the orange and green line show invocation time and invocation cost for a Graviton2 architecture in Lambda function at different memory configurations. You can see how cost and performance differs from the blue and red line representing the corresponding x86 based architecture.\u003C\u002Fp>\n\u003Cp>We always recommend testing your converted functions before you deploy them into production.  \u003C\u002Fp>\n\u003Cp>You can learn more about \u003Ca href=\"https:\u002F\u002Faws.amazon.com\u002Fblogs\u002Fcompute\u002Fmigrating-aws-lambda-functions-to-arm-based-aws-graviton2-processors\u002F\">migrating AWS Lambda functions to Arm based AWS Graviton2 processors.\u003C\u002Fa>\u003C\u002Fp>\n\u003Cp>Resources:\u003C\u002Fp>\n\u003Cul>\n\u003Cli>\u003Ca href=\"https:\u002F\u002Fyoutu.be\u002FAaYNwOh90Pg\">re:Invent 2020 Keynote\u003C\u002Fa>\u003C\u002Fli>\n\u003Cli>\u003Ca href=\"https:\u002F\u002Fdocs.aws.amazon.com\u002Flambda\u002Flatest\u002Fdg\u002Ffoundation-arch.html\">Lambda instruction set architectures documentation\u003C\u002Fa>\u003C\u002Fli>\n\u003C\u002Ful>\n",{"title":6,"order":7},"2. Switch to Graviton2",2,"AWS Graviton2 is a second generation of custom built 64-bit ARM processors, designed to provide better cost and performance. For Lambda functions you can see up to [34% better price performance](https:\u002F\u002Faws.amazon.com\u002Fblogs\u002Faws\u002Faws-lambda-functions-powered-by-aws-graviton2-processor-run-your-functions-on-arm-and-get-up-to-34-better-price-performance\u002F) by switching to Graviton2. \n\nSwitching to this arm64 based architecture is as easy as toggling the radio button in Lambda console to “arm64” from “x86_64”. \n\n\u003Cimg src=\"\u002Fassets\u002Fexternal\u002Fservice\u002Flambda\u002Fguides\u002Fcost-optimization\u002Fassets\u002Fgraviton-01.jpg\"\u002F>\n\nYou can also use AWS CLI to change the architecture:\n\n```sh\naws lambda create-function \\\n    --function-name MyArmFunction \\\n    --runtime nodejs18.x \\\n    --architectures arm64 \\\n    --memory-size 512 \\\n    --zip-file fileb:\u002F\u002FMyArmFunction.zip \\\n    --handler lambda.handler \\\n    --role arn:aws:iam::123456789012:role\u002Fservice-role\u002FMyArmFunction-role\n```\n\nStart by identifying workloads that will benefit most from these gains. Many runtimes already support Graviton2 today (eg. Node.js, Python, Java, .NET) and you can switch your functions with minimal to no changes. A common approach to comparing potential gains is to run your function side by side on both x86_64 and Graviton2 and to analyze cost\u002Fperformance results using the [Lambda Power Tuning](https:\u002F\u002Fdocs.aws.amazon.com\u002Flambda\u002Flatest\u002Foperatorguide\u002Fprofile-functions.html) tool. \n\n\u003Cimg src=\"\u002Fassets\u002Fexternal\u002Fservice\u002Flambda\u002Fguides\u002Fcost-optimization\u002Fassets\u002Fgraviton-02.jpg\"\u002F>\n\nIn the sample Lambda Power Tuning report above, the orange and green line show invocation time and invocation cost for a Graviton2 architecture in Lambda function at different memory configurations. You can see how cost and performance differs from the blue and red line representing the corresponding x86 based architecture.\n\nWe always recommend testing your converted functions before you deploy them into production.  \n\nYou can learn more about [migrating AWS Lambda functions to Arm based AWS Graviton2 processors.](https:\u002F\u002Faws.amazon.com\u002Fblogs\u002Fcompute\u002Fmigrating-aws-lambda-functions-to-arm-based-aws-graviton2-processors\u002F)\n\nResources:\n\n* [re:Invent 2020 Keynote](https:\u002F\u002Fyoutu.be\u002FAaYNwOh90Pg)\n* [Lambda instruction set architectures documentation](https:\u002F\u002Fdocs.aws.amazon.com\u002Flambda\u002Flatest\u002Fdg\u002Ffoundation-arch.html) \n\n",[10],{"title":11,"collapsible":12,"isCollapsed":12,"content":13},"Top 8 Optimizations",false,[14,21,26,33,40,46,52,58],{"title":15,"order":16,"time":17,"path":18,"id":19,"link":20},"1. Fine-tune Lambda power",1,"4 min","1-fine-tuning","1-fine-tuning.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Fcost-optimization\u002F1-fine-tuning",{"title":6,"order":7,"time":22,"path":23,"id":24,"link":25},"2 min","2-graviton","2-graviton.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Fcost-optimization\u002F2-graviton",{"title":27,"order":28,"time":29,"path":30,"id":31,"link":32},"3. Fine-tune CloudWatch Logs",3,"1 min","3-cloudwatch","3-cloudwatch.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Fcost-optimization\u002F3-cloudwatch",{"title":34,"order":35,"time":36,"path":37,"id":38,"link":39},"4. Don't pay for idle",4,"3 min","4-avoid-idle","4-avoid-idle.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Fcost-optimization\u002F4-avoid-idle",{"title":41,"order":42,"time":17,"path":43,"id":44,"link":45},"5. Filter and batch events",5,"5-filter-and-batch","5-filter-and-batch.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Fcost-optimization\u002F5-filter-and-batch",{"title":47,"order":48,"time":36,"path":49,"id":50,"link":51},"6. Set realistic timeouts",6,"6-set-timeouts","6-set-timeouts.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Fcost-optimization\u002F6-set-timeouts",{"title":53,"order":54,"time":29,"path":55,"id":56,"link":57},"7. Use direct integrations",7,"7-direct-integrations","7-direct-integrations.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Fcost-optimization\u002F7-direct-integrations",{"title":59,"order":60,"time":29,"path":61,"id":62,"link":63},"8. Use CloudWatch embedded metric format",8,"8-emf","8-emf.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Fcost-optimization\u002F8-emf","LIST",[66,67,68,69,70],"content\u002Fcontributors\u002Fdan-fox.json","content\u002Fcontributors\u002Fanton-aleksandrov.json","content\u002Fcontributors\u002Fjosh-kahn.json","content\u002Fcontributors\u002Fdhiraj-mahapatro.json","content\u002Fcontributors\u002Fvamsi-vikash-ankam.json","Cost Optimization for AWS Lambda",1789641314913]