View a markdown version of this page

AWSSupportRemediator-UpdateLambdaMemory - Amazon Systems Manager Automation Runbook Reference
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

AWSSupportRemediator-UpdateLambdaMemory

Description

Updates the memory allocation of an Amazon Lambda function to a specified size by calling the Lambda UpdateFunctionConfiguration API.

This automation remediates findings identified by Amazon Well-Architected Agent. It remediates findings from Amazon Compute Optimizer Lambda function recommendations.

If the Lambda function does not exist or its memory already matches the recommended size, the automation completes successfully without making changes.

The automation does not lock the Lambda function during execution. Amazon Remediator serializes runs per Lambda function. Running this runbook from other sources with concurrent, differing RecommendedMemorySize values leaves the final memory size dependent on the order in which the requests complete.

To revert the change, run this runbook again and pass the original memory size from the previous execution's validateInput.InitialMemorySize output.

Changing the memory allocation affects both the performance and the per-invocation cost of the Lambda function. Decreasing memory below what the workload requires can cause out-of-memory errors or longer invocation times. For more information about pricing, see Amazon Lambda pricing.

Important considerations
  • You are responsible for reviewing automation actions before they run.

  • This automation might cause stack drift if the resource is part of an Amazon CloudFormation stack.

  • Access to AWSSupportRemediator-* runbooks requires an active Business Support+, Enterprise Support, or Unified Operations Support plan. For more information, see Compare Amazon Web Services Support Plans on the Amazon website.

Document type

Automation

Owner

Amazon

Platforms

Linux, macOS, Windows

Parameters

  • AutomationAssumeRole

    Type: String

    Description: (Optional) The Amazon Resource Name (ARN) of the Amazon Identity and Access Management (IAM) role that allows Systems Manager Automation to perform the actions on your behalf. If no role is specified, Systems Manager Automation uses the permissions of the user that starts this runbook.

  • LambdaFunctionName

    Type: String

    Description: (Required) The name of the Lambda function to update.

  • RecommendedMemorySize

    Type: Integer

    Description: (Required) The target memory allocation for the Lambda function, in MB. Valid range is 128 to 10240.

Required IAM permissions

The AutomationAssumeRole parameter requires the following actions to use the runbook successfully.

  • lambda:GetFunctionConfiguration

  • lambda:UpdateFunctionConfiguration

Document Steps
  1. validateInput - Validates that the Lambda function exists and determines whether its current memory size differs from the value of the RecommendedMemorySize parameter.

  2. branchOnChangeRequired - Branches on whether the memory requires an update according to the ChangeRequired output from the validateInput step.

  3. updateMemorySize - Updates the memory allocation of the Lambda function to the value of the RecommendedMemorySize parameter by calling the Lambda UpdateFunctionConfiguration API.

Outputs
  • validateInput.InitialMemorySize: The initial memory size of the Lambda function before any changes.

  • validateInput.ValidationMessage: The reason for the validation result.

  • updateMemorySize.NewMemorySize: The new memory size of the Lambda function after the update.