class FunctionRuntime
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.CloudFront.FunctionRuntime |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awscloudfront#FunctionRuntime |
Java | software.amazon.awscdk.services.cloudfront.FunctionRuntime |
Python | aws_cdk.aws_cloudfront.FunctionRuntime |
TypeScript (source) | aws-cdk-lib » aws_cloudfront » FunctionRuntime |
The function's runtime environment version.
Example
// Add a cloudfront Function to a Distribution
const cfFunction = new cloudfront.Function(this, 'Function', {
code: cloudfront.FunctionCode.fromInline('function handler(event) { return event.request }'),
runtime: cloudfront.FunctionRuntime.JS_2_0,
});
declare const s3Bucket: s3.Bucket;
new cloudfront.Distribution(this, 'distro', {
defaultBehavior: {
origin: new origins.S3Origin(s3Bucket),
functionAssociations: [{
function: cfFunction,
eventType: cloudfront.FunctionEventType.VIEWER_REQUEST,
}],
},
});
Properties
Name | Type | Description |
---|---|---|
value | string | |
static JS_1_0 | Function | cloudfront-js-1.0. |
static JS_2_0 | Function | cloudfront-js-2.0. |
value
Type:
string
static JS_1_0
Type:
Function
cloudfront-js-1.0.
static JS_2_0
Type:
Function
cloudfront-js-2.0.
Methods
Name | Description |
---|---|
static custom(runtimeString) | A custom runtime string. |
static custom(runtimeString)
public static custom(runtimeString: string): FunctionRuntime
Parameters
- runtimeString
string
Returns
A custom runtime string.
Gives full control over the runtime string fragment.