Simple project shows a command_job.rb class that allows you to run any command remotely on AWS Lambda.
This could be used to do maintenance things like migrate the database if you only have access to the database within Lambda: How do I Migrate the Database?
There is a general execute
method where you and specific the command in the event payload, example:
{
command: "whoami"
}