Skip to content

Conversation

@omercnet
Copy link

@omercnet omercnet commented Nov 13, 2025

This pull request introduces support for deploying an AWS ElastiCache Serverless Redis instance using the SST framework. It adds a new serverless option to the Redis component, enabling automatic scaling and pay-per-use pricing, and updates documentation and example code to demonstrate usage. The changes include updates to the Redis component API, resource creation logic, and a new example project.

fixes #6160

Serverless Redis feature:

  • Added a new serverless option to the RedisArgs interface in platform/src/components/aws/redis.ts, allowing users to enable ElastiCache Serverless Redis and configure usage-based limits for data storage and ECPU per second.
  • Updated the Redis component implementation to create a serverless Redis cache when the serverless option is enabled, including logic for resource creation, references, and output properties such as host and port. [1] [2] [3] [4] [5] [6]
  • Extended the API documentation and usage examples for the Redis component to cover serverless mode, configuration options, and linking to other resources. [1] [2]

Example project and documentation:

  • Added a new example project in examples/aws-redis-serverless with configuration, handler code, and documentation showing how to deploy and use serverless Redis with SST. [1] [2] [3] [4]

@vimtor vimtor self-assigned this Dec 11, 2025
Copy link
Collaborator

@vimtor vimtor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the contribution @omercnet

i've tested this branch and left some comments on the issues i found

* }
* ```
*/
dataStorage?: Input<{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we keep the interface consistent with other SST interfaces so it looks like this:

        storage: { maximum: "10 GB" },

also it would be nice if we added the minimum to both storage and ecpuPerSeconds


const vpc = normalizeVpc();
const serverless = normalizeServerless();
if (serverless.enabled) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since normalizeServerless returns an Output, the if (serverless.enabled) expression always evalutates to true, thus always creating a serverless cluster

};
},
async run() {
// Serverless Redis doesn't require NAT Gateways
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

even though serverless redis doesn't require a NAT gateway, in my testings i had to add it otherwise the lambda function wasn't accesible while sst gave this warning:

Warning: One or more functions are deployed in the "vpc-04554314d7b657e92" VPC, which does not have a NAT gateway. As a result, these functions cannot access the internet. If your functions need int ernet access, enable it by setting the "nat" prop on the "Vpc" component.

checkServerIdentity: () => undefined,
},
username: Resource.MyRedis.username,
password: Resource.MyRedis.password,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking at the code when creating a serverless redis we don't generate a password, i don't know if this is on purpose but this line gives the error: Property password does not exist on type

this.cluster = cluster;
this._authToken = authToken;

function reference() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't see any code for handling the case of sst.aws.Redis.get for the serverless case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add support serverless redis on aws

3 participants