
Route traffic dynamically between API Gateway endpoints using CloudFront Functions and Key Value Store without redeploying infrastructure.
git clone https://github.com/aws-samples/serverless-patterns/cd serverless-patterns/cloudfront-keyvaluestore-apigw-routing-cdkClone the repository: <code>git clone https://github.com/aws-samples/serverless-patterns</code>Change directory: <code>cd cloudfront-keyvaluestore-apigw-routing-cdk</code>Install dependencies: <code>npm install</code>Deploy the CDK stack: <code>cdk deploy</code>aws cloudfront-keyvaluestore describe-key-value-store --kvs-arn=[KVSTOREARN]aws cloudfront-keyvaluestore update-keys --kvs-arn=[KVSTOREARN] --if-match=[ETAG] --puts '[{"Key": "APIGW1URL", "Value": "[APIGATEWAY1URL]"},{"Key": "APIGW2URL", "Value": "[APIGATEWAY2URL]"}]'curl -i -L [CLOUDFRONTDOMAINNAME]{"message": "Hello from API 1"} or {"message": "Hello from API 2"}cdk destroy