내용으로 건너뛰기

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

질문됨 2년 전1.2천회 조회

1개 답변
0
수락된 답변

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.

전문가

답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.