1- import { LayerVersion , LayerVersionOptions } from 'aws-cdk-lib/aws-lambda' ;
1+ import {
2+ LayerVersion ,
3+ LayerVersionOptions ,
4+ Architecture ,
5+ } from 'aws-cdk-lib/aws-lambda' ;
26import { Construct } from 'constructs' ;
37import { Bundling } from './bundling' ;
48import { getManifestPath } from './cargo' ;
@@ -9,10 +13,10 @@ import { BundlingOptions } from './types';
913 */
1014export interface RustExtensionProps extends LayerVersionOptions {
1115 /**
12- * Bundling options
13- *
14- * @default - use default bundling options
15- */
16+ * Bundling options
17+ *
18+ * @default - use default bundling options
19+ */
1620 readonly bundling ?: BundlingOptions ;
1721
1822 /**
@@ -57,24 +61,38 @@ export interface RustExtensionProps extends LayerVersionOptions {
5761 * temporary directory.
5862 */
5963 readonly gitForceClone ?: boolean ;
64+
65+ /**
66+ * The system architecture of the lambda extension
67+ *
68+ * @default - Architecture.X86_64
69+ */
70+ readonly architecture ?: Architecture ;
6071}
6172
6273/**
6374 * A Lambda extension written in Rust
6475 */
6576export class RustExtension extends LayerVersion {
66- constructor ( scope : Construct , resourceName : string , props ?: RustExtensionProps ) {
77+ constructor (
78+ scope : Construct ,
79+ resourceName : string ,
80+ props ?: RustExtensionProps ,
81+ ) {
6782 const manifestPath = getManifestPath ( props || { } ) ;
6883 const bundling = props ?. bundling ?? { } ;
84+ const architecture = props ?. architecture ?? Architecture . X86_64 ;
6985
7086 super ( scope , resourceName , {
7187 ...props ,
88+ compatibleArchitectures : [ architecture ] ,
7289 code : Bundling . bundle ( {
7390 ...bundling ,
7491 manifestPath,
7592 binaryName : props ?. binaryName ,
7693 lambdaExtension : true ,
94+ architecture,
7795 } ) ,
7896 } ) ;
7997 }
80- }
98+ }
0 commit comments