Saltar al contenido

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

preguntada hace 2 años1,2 mil visualizaciones

1 Respuesta
0
Respuesta aceptada

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.

EXPERTO

respondido hace 2 años

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.