Can I and Is its good practice to host docker image and nodejs api in same ec2 instance?

Actually I am using Prisma graphql to develop my app with Mongodb,

What I am planning to do it host MongoDB on MongoDB Cloud and host Prisma service and my nodejs-graphql API to same ec2 instance, so is it good practise doing so if not then what is the best way?

Source: StackOverflow