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.
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
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/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.