# Architecture

Architectures supported by AWS Lambda.

Obtainable from: Architecture.ARM_64, Architecture.X86_64, Architecture.custom

- Source: [`aws-lambda/lib/architecture.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0/packages/aws-cdk-lib/aws-lambda/lib/architecture.ts#L4)
- Type last changed: v2.88.0 · 20 Jul 2023

## Example

TypeScript:

```ts
new lambda.Function(this, 'MyFunction', {
  runtime: lambda.Runtime.NODEJS_LATEST,
  handler: 'index.handler',
  architecture: lambda.Architecture.ARM_64,
  code: lambda.Code.fromAsset(path.join(__dirname, 'lambda-handler')),
  insightsVersion: lambda.LambdaInsightsVersion.VERSION_1_0_119_0,
});
```

Python:

```python
lambda_.Function(self, "MyFunction",
    runtime=lambda_.Runtime.NODEJS_LATEST,
    handler="index.handler",
    architecture=lambda_.Architecture.ARM_64,
    code=lambda_.Code.from_asset(path.join(__dirname, "lambda-handler")),
    insights_version=lambda_.LambdaInsightsVersion.VERSION_1_0_119_0
)
```

Java:

```java
Function.Builder.create(this, "MyFunction")
        .runtime(Runtime.NODEJS_LATEST)
        .handler("index.handler")
        .architecture(Architecture.ARM_64)
        .code(Code.fromAsset(join(__dirname, "lambda-handler")))
        .insightsVersion(LambdaInsightsVersion.VERSION_1_0_119_0)
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
new Function(this, "MyFunction", new FunctionProps {
    Runtime = Runtime.NODEJS_LATEST,
    Handler = "index.handler",
    Architecture = Architecture.ARM_64,
    Code = Code.FromAsset(Join(__dirname, "lambda-handler")),
    InsightsVersion = LambdaInsightsVersion.VERSION_1_0_119_0
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
lambda.NewFunction(this, jsii.String("MyFunction"), &FunctionProps{
	Runtime: lambda.Runtime_NODEJS_LATEST(),
	Handler: jsii.String("index.handler"),
	Architecture: lambda.Architecture_ARM_64(),
	Code: lambda.Code_FromAsset(path.join(__dirname, jsii.String("lambda-handler"))),
	InsightsVersion: lambda.LambdaInsightsVersion_VERSION_1_0_119_0(),
})
```

## Properties

- `ARM_64`: [Architecture](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Architecture.html) (static) — 64 bit architecture with the ARM instruction set.

- `dockerPlatform`: string — The platform to use for this architecture when building with Docker.

- `name`: string — The name of the architecture as recognized by the AWS Lambda service APIs.

- `X86_64`: [Architecture](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Architecture.html) (static) — 64 bit architecture with x86 instruction set.

## Methods

- `custom(name: string, dockerPlatform?: string): Architecture // chainable` (static) — Used to specify a custom architecture name.

  Use this if the architecture name is not yet supported by the CDK.

  **Parameters**

  - `name` — the architecture name as recognized by AWS Lambda.
  - `dockerPlatform` — the platform to use for this architecture when building with Docker.

- `toString(): string` — Returns a string representation of the architecture using the name.
