admin管理员组

文章数量:1300203

We have a Rails API container and execute some short-running batch jobs using the following commands:

  • bundle exec rake execute[NotifyAction] RAILS_ENV=staging
  • bundle exec rails runner Emails::CheckingTask.execute RAILS_ENV=staging

Currently, we use the docker run command to execute these tasks on EC2, but now we want to run them in an AWS Lambda container.

I found that we need to use the AWS Lambda Ruby Runtime Interface Client (RIC) for this, but I am unsure how to run bundle exec rake execute and bundle exec rails runner inside the Lambda handler function.

Has anyone successfully implemented this? I am not a Ruby on Rails developer, so any advice would be greatly appreciated.

I tried using the open3 gem to execute these commands from the handler function but encountered multiple errors.

本文标签: amazon web servicesHow to run RailsRake Tasks in an AWS Lambda ContainerStack Overflow