Ruby on Rails on Lambda on Arm64/Graviton2!

Today I am happy to announce that Lamby (Simple Rails & AWS Lambda Integration using Rack) now demonstrates just how easy it is to use multi-platform arm64 images on AWS Lambda. If this sounds interesting to you, jump right into our Quick Start gui…


This content originally appeared on DEV Community 👩‍💻👨‍💻 and was authored by Ken Collins

Today I am happy to announce that Lamby (Simple Rails & AWS Lambda Integration using Rack) now demonstrates just how easy it is to use multi-platform arm64 images on AWS Lambda. If this sounds interesting to you, jump right into our Quick Start guide and deploy a new Rails 7 on Ruby 3.2 Ubuntu image to see it for yourself.

Yay! You're on Rails! welcome page which has been extended by Lamby to show the Rails version, Ruby version, and machine architecture. There is some markup drawing on this page which uses an mechanical arm emoji and a big arrow pointing to the text at the bottom that says aarch64-linux. Cool!

How It Works?

First, AWS has made this incredibly easy since their release in September '21 where AWS SAM can simply switch the deployment architecture in your serverless project's template.yml file:

 Properties:
   Architectures:
-    - arm64
+    - x86_64

Second, make sure your base Docker image supports the arm64 architecture. Most popular images use multi-platform builds already. For example, here is the official Ruby image we use in Lamby's demo project.

$ docker manifest inspect ruby:3.2 | grep arch
            "architecture": "amd64",
            "architecture": "arm64",

Lastly, make sure your deployment machine matches the production target architecture. This is needed to ensure native dependencies (like the MySQL client) are built to match the Docker image architecture eventually being run in production. If you are on a M1/M2 Mac, you can deploy from your own machine.

However, for real production CI/CD, you are better off using something like CircleCI's Arm Execution Environment. Currently GitHub Actions lacks native support for Arm64 Runners, but that issue is being tracked and I suspect is soon to come.

In the meantime, Lamby's demo projects includes a working CircleCI CI/CD example for you that leverages the arm.large machine type.

default-machine: &default-machine
  machine:
    image: ubuntu-2204:current
    docker_layer_caching: true
  resource_class: arm.large

Thanks! Please take the time to learn more about Rails on Lambda using Lamby along with how to use arm64 with Graviton2 with your Lambda applications on our site:


This content originally appeared on DEV Community 👩‍💻👨‍💻 and was authored by Ken Collins


Print Share Comment Cite Upload Translate Updates
APA

Ken Collins | Sciencx (2023-02-18T15:40:37+00:00) Ruby on Rails on Lambda on Arm64/Graviton2!. Retrieved from https://www.scien.cx/2023/02/18/ruby-on-rails-on-lambda-on-arm64-graviton2/

MLA
" » Ruby on Rails on Lambda on Arm64/Graviton2!." Ken Collins | Sciencx - Saturday February 18, 2023, https://www.scien.cx/2023/02/18/ruby-on-rails-on-lambda-on-arm64-graviton2/
HARVARD
Ken Collins | Sciencx Saturday February 18, 2023 » Ruby on Rails on Lambda on Arm64/Graviton2!., viewed ,<https://www.scien.cx/2023/02/18/ruby-on-rails-on-lambda-on-arm64-graviton2/>
VANCOUVER
Ken Collins | Sciencx - » Ruby on Rails on Lambda on Arm64/Graviton2!. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2023/02/18/ruby-on-rails-on-lambda-on-arm64-graviton2/
CHICAGO
" » Ruby on Rails on Lambda on Arm64/Graviton2!." Ken Collins | Sciencx - Accessed . https://www.scien.cx/2023/02/18/ruby-on-rails-on-lambda-on-arm64-graviton2/
IEEE
" » Ruby on Rails on Lambda on Arm64/Graviton2!." Ken Collins | Sciencx [Online]. Available: https://www.scien.cx/2023/02/18/ruby-on-rails-on-lambda-on-arm64-graviton2/. [Accessed: ]
rf:citation
» Ruby on Rails on Lambda on Arm64/Graviton2! | Ken Collins | Sciencx | https://www.scien.cx/2023/02/18/ruby-on-rails-on-lambda-on-arm64-graviton2/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.