Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I want to be able to change the architecture of the lambda function. #913

Closed
eternity1984 opened this issue Oct 28, 2024 · 1 comment · Fixed by #914
Closed

I want to be able to change the architecture of the lambda function. #913

eternity1984 opened this issue Oct 28, 2024 · 1 comment · Fixed by #914

Comments

@eternity1984
Copy link
Contributor

eternity1984 commented Oct 28, 2024

Is your feature request related to a problem? Please describe.
I use an Apple silicon MacBook.
An error occurred when I ran the deployed function. This is likely due to Certbot using an arm64-based Python 3.10 image for building, while the deployment environment runs on the x86_64 architecture.

{
  "errorMessage": "Unable to import module 'index': /var/task/cryptography/hazmat/bindings/_rust.abi3.so: cannot open shared object file: No such file or directory",
  "errorType": "Runtime.ImportModuleError",
  "requestId": "",
  "stackTrace": []
}

Describe the solution you'd like
I want it to be deployed and ready to go.

Describe alternatives you've considered
I manually change the architecture to arm64 and re-upload the built code, it works.

Additional context

Proposed implementation
Makes architecture parameters configurable.

@@ -254,6 +254,7 @@ export class Certbot extends Construct {
     this.handler = new lambda.Function(this, 'handler', {
       runtime: lambda.Runtime.PYTHON_3_10,
       role,
+      architecture: props.architecture || lambda.Architecture.X86_64,
       code: lambda.Code.fromAsset(functionDir, {
         bundling: {
           image: lambda.Runtime.PYTHON_3_10.bundlingImage,
const certbot = new Certbot(this, "Certbot", {
  functionName: functionName,
  letsencryptDomains: zoneName,
  letsencryptEmail: "le@domain.tld",
  hostedZones: [publicHostedZone],
  certificateStorage: CertificateStorageType.SECRETS_MANAGER,
  architecture: lambda.Architecture.ARM_64,
});

Any currently forseeable downsides to this approach

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants