Momento CLI is Momento Serverless Cache on the command line. It brings account creation, maintenance, cache control and data commands to the terminal.
Momento CLI is a command-line interface designed to provide developers and IT professionals with direct access to Momento Serverless Cache. This tool enables users to create accounts, manage cache configurations, and execute data operations directly from the terminal.
Key Features:
Account creation and management for seamless setup and maintenance.
Direct control over cache configurations to optimize performance.
Data manipulation capabilities for efficient caching workflows.
Audience & Benefit:
Ideal for developers and IT teams who require a flexible and scalable caching solution. Momento CLI streamlines cache management, allowing users to focus on building applications without leaving the command line. It can be installed via winget, ensuring easy integration into existing workflows.
First things first - go to the Momento Console to sign up. Generate an auth token to use with the CLI in the tokens tab.
This token uniquely identifies cache interactions. The token should be treated like a sensitive password and all essential care must be taken to ensure its secrecy. We recommend that you store this token in a secret vault like AWS Secrets Manager. See the docs for more information on Momento auth tokens.
Installation
Mac (intel or apple silicon)
brew tap momentohq/tap
brew install momento-cli
Upgrading to a newer version
brew upgrade momento-cli
Linux
Visit the web page for the latest github release.
There, you will find .deb and .rpm files for both x86_64 and aarch64.
.deb files have been tested on modern versions of Ubuntu and Debian.
.rpm files have been tested on modern versions of RHEL, Amazon Linux 2, Rocky Linux, and CentOS.
If you have problems with any of these packages on your favorite platform, please file an issue and let us know!
We also provide tarballs for both x86_64 and aarch64; these contain the momento binary,
which you may add anywhere you like in your execution path.
Windows
Our CLI is available in the Windows Package Manager (winget). To install, run the following from PowerShell or the Command Prompt:
winget install momento.cli
Alternatively visit the web page for the latest github release.
There you will find an .msi installer for Windows platforms, as well as a windows .zip file if
you prefer to manually copy the executable to your preferred location.
If you have problems with the windows packages please file an issue and let us know!
Tab Completion
We provide tab completion configuration for zsh and bash. For linux installs via deb/rpm, no additional shell
configuration should be necessary if you already have zsh/bash tab completion enabled. For Homebrew, see
https://docs.brew.sh/Shell-Completion
Quick Start
These instructions assume you have the momento executable on your path, after following
the appropriate installation steps above.
# Configure your account with the auth token copied from the console
# plus default cache name (`default-cache`) and TTL (600 seconds)
# This will also create the cache `default-cache` in your account
momento configure --quick
# Set and Get values from your default cache, with default ttl
momento cache set key value
momento cache get key
# Make a different cache
momento cache create example-cache
# Set and Get values from a non-default cache with a different ttl
momento cache set key value --ttl 100 --cache example-cache
momento cache get key --cache example-cache
Configure
First time configuration
# default profile name is default
momento configure
This will prompt you for your Momento Auth Token, default cache name, default TTL, and save them to be reused as a part of your default profile.
momento configure --profile new-profile
This will prompt you the same as above and save them to be reused as a part of your new-profile profile.
Update existing configuration
To update your desired profile, use the same command as above.
Use CLI
# use default profile
momento cache create example-cache
momento cache set key value --ttl 100 --cache example-cache
momento cache get key --cache example-cache
You can also specify your desired profile.
# use new-profile
momento cache create example-cache --profile new-profile
momento cache set key value --ttl 100 --cache example-cache --profile new-profile
momento cache get key --cache example-cache --profile new-profile
Use Momento in Your Project
Check out our SDKs to integrate Momento into your project!
Contributing
If you would like to contribute to the Momento Cli, please read out Contributing Guide