You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To locally create a new project from this example run:
mantil new app --from mongo-atlas
cd app
Configuration
Before deploying your application you will need to create Mongo Atlas cluster. Detailed instructions on how to create a cluster can be found in documentation.
Once your cluster is created you need to add connection URI to config/environment.yml as env variable for your function. Instructions on how to get this URI can be found here.
project:
env:
CONNECTION_URI: # connection uri to mongo atlas
Deploying an application
Note: If this is the first time you are using Mantil you will need to install Mantil Node on your AWS account. For detailed instructions please follow the setup guide
mantil aws install
After configuring the environment variable you can proceed with application deployment.
mantil deploy
This command will create a new stage for your project with default name development and deploy it to your node.
Now you can output the stage endpoint with mantil env -u. The API endpoint for your function will have the name of that function in the path, in our case that is $(mantil env -u)/db.
Querying database
After deploying application you can start working with the mongo database.
What follows are invoke examples for creating, fetching and deleting items.
To remove the created stage with all resources from your AWS account destroy it with
mantil stage destroy development
Final thoughts
With this template you learned how to use AWS Lambda with Mongo Atlas. Check out our documentation to find more interesting templates.
If you have any questions or comments on this concrete template or would just like to share your view on Mantil contact us at support@mantil.com or create an issue.