AWS Lambda has support for Ruby 2.5, and it's straightforward to run a simple Ruby script in this environment
However, suppose your script requires some gems, how do you install and use gems in AWS Lambda?
Install the gems into the project folder by using the --path flag when running bundle install. Then include the installed dependencies in your .zip.source bundle. There are docs on creating a Ruby bundle.
Another option would be to create a lambda layer, which can make your deploys faster (smaller zip file) and be used to organize your code.