Skip to content

Official cloudformation resource to manage momento serverless caches.

License

Notifications You must be signed in to change notification settings

momentohq/cfn-cache

Repository files navigation

Momento::SimpleCache::Cache

Official cloudformation resource to manage momento serverless caches.

Please see our Docs page for full end user docs and usage instructions for using this resource in your templates.

Registering and Using this resource in your account

To use this resource in your account it currently needs to be registered as a private cloudformation extension per AWS account and region you want to use it in. You will need to install the AWS CFN CLI locally to submit the resource.

Once you have the CFN-CLI installed and have AWS credentials for the account you want to deploy you can submit this resource to be registered in your account in region of your choice.

make build
cfn submit  --set-default -v --region us-east-1

Usage

Once you have the Momento::SimpleCache::Cache cfn extension installed you can start provisioning caches in your account

Bootstrap account with your momento auth token in secrets manager

export MOMENTO_AUTH_TOKEN=eyjbTestToken
aws secretsmanager create-secret \
    --name /momento/authToken \
    --secret-string $MOMENTO_AUTH_TOKEN

replace $MOMENTO_AUTH_TOKEN value with token received during signup

Create test.yml file with following contents

AWSTemplateFormatVersion: 2010-09-09

Resources:
  MyCache:
    Type: Momento::SimpleCache::Cache
    Properties:
      Name: test-cache
      AuthToken: '{{resolve:secretsmanager:/momento/authToken}}'

Deploy test stack

aws cloudformation create-stack \
    --region us-west-2 \
    --template-body "file://test.yml" \
    --stack-name "test-cache-stack"

Development

If you want to contribute to this repo and develop on this resource please follow these instructions

Pre-Reqs:

  1. Python version 3.6 or above.
  2. AWS CLI
  3. SAM CLI
  4. CFN CLI

Set up a local json file to pass env vars in for testings called local-e2e-test.json

Its contents should look like this:

{
  "TypeFunction": {
    "MODE": "TEST",
    "MOMENTO_AUTH_TOKEN": "REPLACE_ME"
  }
}

Build resource

make

Start Local lambda

sam local start-lambda -n local-e2e-test.json

Run Tests

cfn test

About

Official cloudformation resource to manage momento serverless caches.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published