RuntimeConfig
RuntimeConfig is a property of AWS::Serverless::Function that configures an AWS Lambda (Lambda) Event Function to use a customer-managed runtime. You specify the runtime and the runtime alias that the function uses. The runtime publisher controls which runtime version the alias points to.
AWS SAM supports functions that use an existing customer-managed runtime. It doesn't provide a resource type for creating or publishing runtimes. To create a runtime, see Creating a runtime in the AWS Lambda Developer Guide.
To use RuntimeConfig, set the function's Runtime property to custom. To learn more about customer-managed runtimes, see Customer-managed runtimes and Using a customer-managed runtime in the AWS Lambda Developer Guide.
Syntax
To declare this entity in your AWS Serverless Application Model (AWS SAM) template, use the following syntax.
YAML
RuntimeAlias:StringRuntimeArn:String
Properties
RuntimeConfig has the following properties. You must specify both.
-
RuntimeAlias -
The name of the runtime alias that the function uses, such as
prod. The alias points to a runtime version. By default, when the runtime publisher points the alias to a new runtime version, the function uses the new version at its next cold start. To control when your function picks up runtime updates, use RuntimeManagementConfig.Type: String
Required: Yes
CloudFormation compatibility: This property is passed directly to the RuntimeAlias property of the
AWS::Lambda::FunctionRuntimeConfigdata type. -
RuntimeArn -
The Amazon Resource Name (ARN) of the customer-managed runtime, such as
arn:aws:lambda:us-east-1:111122223333:runtime/companyphp8. Specify the ARN of the runtime, not the ARN of a runtime alias. The runtime must be in the same AWS Region as the function.To create a function that uses the runtime, or to change its
RuntimeConfig, you need thelambda:AssociateRuntimeAliaspermission on the runtime alias. To use a runtime that another AWS account owns, the runtime's resource-based policy must also allow your account to use it. For more information, see Before you begin in the AWS Lambda Developer Guide.Type: String
Required: Yes
CloudFormation compatibility: This property is passed directly to the RuntimeArn property of the
AWS::Lambda::FunctionRuntimeConfigdata type.
Examples
RuntimeConfig
The following example configures a function to use the prod alias of a customer-managed runtime. The function must also set Runtime to custom.
YAML
RuntimeConfig: RuntimeArn:arn:aws:lambda:us-east-1:111122223333:runtime/companyphp8RuntimeAlias:prod