Upstash provides a serverless Redis service, which allows you to use the fast, in-memory NoSQL data store without having to manage your own servers. With its per-request pricing and low latency, Upstash is a great choice for serverless applications.
Advantages
- REST API: You can access your database using a simple REST API.
- Secure: You can enable TLS with a single click.
- Highly available: You can enable multi-zone replication to ensure that your data is always available.
- Pay-per-request: You only pay for what you use. See the Upstash pricing for more details.
- Scalable: Upstash automatically scales to meet your needs.
Disadvantages
- Separate billing: Although Stacktape integrates with Upstash, you will still need to manage your billing separately.
Provider configuration
To use Upstash with Stacktape, you will need to:
- Create an Upstash account.
- Get your API key from the Upstash console.
- Store your credentials (the email address for your Upstash account and your API key) in a secret.
UpstashProviderAPI referenceaccountEmailRequired
Email address of your Upstash account.
Type: string
apiKeyRequired
API key for your Upstash account. Store as $Secret() for security.
Type: string
Create an API key in the Upstash console under Account > API Keys.
Basic usage
The code for the
myFunctionfunction.
UpstashRedisAPI referencetypeRequired
Type: string "upstash-redis"
properties.enableEviction
Auto-remove old keys when memory is full. Prioritizes keys with TTL set. Enable for cache use cases.
Type: boolean
Without eviction, writes fail once the memory limit is reached. Enable this for caching workloads.
overrides
Escape hatch to modify the underlying CloudFormation resources Stacktape creates.
Type: Object
Use dot-notation paths to override specific properties on any child resource.
Find resource logical IDs with stacktape stack-info --detailed.
overrides:
MyDbInstance:
Properties.StorageEncrypted: true
Deployment region
Upstash Redis is currently available in the following regions:
- us-east-1
- us-west-1
- us-west-2
- eu-west-1
- eu-central-1
- ap-southeast-1
- ap-southeast-2
- sa-east-1
If you deploy your stack in a different region, Stacktape will automatically deploy the database in the region that is geographically closest to your stack's region.
Enable eviction
Without eviction, writes fail once the memory limit is reached. Enable this for caching workloads.
Referenceable parameters
The following parameters can be easily referenced using $ResourceParam directive directive.
To learn more about referencing parameters, refer to referencing parameters.
Hostname (address) of the Upstash Redis database.
- Usage:
$ResourceParam('<<resource-name>>', 'host')
Port of the Upstash Redis database.
- Usage:
$ResourceParam('<<resource-name>>', 'port')
Autogenerated password that can be used to authenticate towards the database.
- Usage:
$ResourceParam('<<resource-name>>', 'password')
Rest token which can be used when reading/writing from/to the database using the REST API
- Usage:
$ResourceParam('<<resource-name>>', 'restToken')
Rest token which can be used only for reading from the database using the REST API
- Usage:
$ResourceParam('<<resource-name>>', 'readOnlyRestToken')
Rest URL which can be used when communicating with the database using the REST API
- Usage:
$ResourceParam('<<resource-name>>', 'restUrl')
Standard redis url (including password) which can be used for connecting using cli.
- Usage:
$ResourceParam('<<resource-name>>', 'redisUrl')