Direkt zum Inhalt

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

gefragt vor 2 Jahren1245 Aufrufe

1 Antwort
0
Akzeptierte Antwort

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.

EXPERTE

beantwortet vor 2 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.