Ruby On Jets - Connect MongoAtlas using VPC peering aws Lambda

I’m building an application using Jets framework.

I am using gem "mongoid" to connect with mongo Atlas cluster and deploying the app AWS (AWS lambda).

Right now the application is connected with Mongo Atlas Cluster.
here is my mongoid.conf file:

      uri: mongodb+srv://
        server_selection_timeout: 5

Now I am using VPC Peering for MongoAtlas and AWS and now I want to connect my Jets application through VPC Peering with MongoAtlas.

I am confused how do I use AWS VPC peering configuration in my Ruby on Jets application

This may help. Is anyone using vpc_config?
If the VPCs are peered, then you should be able to whitelist the security groups to connect. Maybe start with the essential elements first. Would try launching an EC2 instance to the subnet and security group that you intend to use and make sure you can connect first. That’s probably the main issue. Once that’s confirmed then would configured the lambda function to use the same subnet and security group.