Skip to content

Add architecture to RustExtension #76

Closed

Description

@garysassano

The compatiblearchitectures property is not available in RustExtension, so it always compiles for x64.

A workaround is to manually specify the architecture flag in the bundling property:

const myExtension = new RustExtension(
  this,
  "MyExtension",
  {
    manifestPath: join(
      __dirname,
      "..",
      "layers/my-extension",
      "Cargo.toml",
    ),
    bundling: { cargoLambdaFlags: ["--quiet", "--arm64"] },
  },
);

It would be more convenient to introduce an architecture property that accepts either Architecture.X86_64 (default) or Architecture.ARM_64. Setting this property would not only automatically add the --arm64 flag but also configure the layer correctly in the AWS Console:

Image

Activity

  1. calavera commented on Mar 13, 2025

    @calavera
    Contributor

    That makes sense, although I would probably just call it architecture to match the option in RustFunction. This should be easy to add if you feel like opening a Pull Request with the addition.

  2. garysassano commented on Mar 13, 2025

    @garysassano
    ContributorAuthor

    Yeah, I agree architecture is actually a better name.

  3. changed the title [-]Add `compatibleArchitecture` to `RustExtension`[/-] [+]Add `architecture` to `RustExtension`[/+] on Mar 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions