View a markdown version of this page

AWSSupportRemediator-ResizeLambdaMemory - 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-ResizeLambdaMemory

Description

Updates the memory allocation of an Amazon Lambda function to the recommended size.

This automation remediates findings identified by Amazon Well-Architected Agent. It remediates findings from Amazon Trusted Advisor check Amazon Lambda over-provisioned functions for memory size.

If the Lambda function does not exist, the actual memory differs from the value reported by Trusted Advisor, or the memory is already at or beyond the recommended size, the automation completes successfully without making changes.

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.

  • CurrentMemorySizeFromTrustedAdvisor

    Type: Integer

    Description: (Required) The current memory allocation of the Lambda function as reported by Trusted Advisor, in MB. If the actual memory differs from this value, the automation takes no action.

  • LambdaFunctionName

    Type: String

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

  • RecommendedMemorySize

    Type: Integer

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

Required IAM permissions

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

  • lambda:GetFunctionConfiguration

  • lambda:UpdateFunctionConfiguration

Document Steps
  1. validateNewMemoryValue - Validates that the Lambda function exists and determines whether a memory change is required.

  2. branchOnChangeRequired - Branches on whether memory modification is needed.

  3. setNewMemoryValue - Updates the Lambda function memory configuration to the recommended size.

Outputs
  • validateNewMemoryValue.CurrentSetMemory: The current memory allocation of the Lambda function before modification.

  • setNewMemoryValue.NewSetMemory: The new memory allocation of the Lambda function after modification.

  • validateNewMemoryValue.ValidationMessage: A message describing the validation result.