AcceleratorConfig
AcceleratorConfig is a property of AWS::Serverless::Function that configures accelerator resources, such as GPUs, for an AWS Lambda (Lambda) function that runs on Lambda Managed Instances. You specify
the amount of accelerator memory that Lambda allocates to each execution environment of the function.
To use AcceleratorConfig, the function must also specify CapacityProviderConfig. Lambda supports accelerator
configuration only for functions that use the Image package type and the x86_64
architecture.
Syntax
To declare this entity in your AWS Serverless Application Model (AWS SAM) template, use the following syntax.
YAML
AcceleratorMemorySize:Integer
Properties
AcceleratorConfig has the following property.
-
AcceleratorMemorySize -
The amount of accelerator memory, in GiB, that Lambda allocates to each execution environment.
Valid values:
3,6,12,16,24, or48Type: Integer
Required: Yes
CloudFormation compatibility: This property is passed directly to the AcceleratorMemorySize property of the
AWS::Lambda::FunctionAcceleratorConfigdata type.
Examples
GPU function on a capacity provider
The following example defines a container image function that requests 24 GiB of accelerator memory and runs on a capacity provider.
YAML
Resources: MyGpuFunction: Type: AWS::Serverless::Function Properties: PackageType: Image ImageUri:111122223333.dkr.ecr.us-east-1.amazonaws.com/my-gpu-image:latestArchitectures: - x86_64 MemorySize: 2048 CapacityProviderConfig: Arn: !GetAttMyCapacityProvider.Arn AcceleratorConfig: AcceleratorMemorySize: 24