Cloudfront Function's Key Value Store: Not matching on non-letters keys

0

Hi, I'm using the CloudFront function and the key-value store feature. I want to build a CloudFront function that will redirect specific URIs (keys) to different URIs (values) using the key-value-store to hold this mapping. URIs can consist of letters and numbers. Although the key-value-store accepts any key, when I use the get helper function in the CloudFront function, I get matches only when the key consists of letters and underscores.

For example - let's say I have the following keys and values in the key-value-store: Key Value test replace1 test2 replace2

kvsHandle.get(key) finds a match for key: test but doesn't find a match for key: test2

asked a year ago816 views
1 Answer
0
Accepted Answer

I'm reasonably sure the key value store simply does a hashtable/dictionary lookup of whatever string literal it's passed and won't care what characters it contains. The announcement blog for the key value store had practically the exact same example as yours, with "key1" mapped to "val1" and "key2" to "val2": https://aws.amazon.com/blogs/aws/introducing-amazon-cloudfront-keyvaluestore-a-low-latency-datastore-for-cloudfront-functions/

I suggest you start by checking with the CLI or the console what you actually have in the key value store and, for example, that there aren't empty spaces where they don't belong. And of course, note that it takes some time for updates to the store to replicate to edge locations.

EXPERT
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions