By using AWS re:Post, you agree to the Terms of Use
/How can I route traffic depending on setting from parameter store./

How can I route traffic depending on setting from parameter store.

0

Hi, I'm looking to see what options are available and what might be the best practice to accomplish routing HTTP traffic based on a parameter within the parameter store. Currently we have multiple services all sending HTTP traffic to a single URL. This receiving endpoint is about to be duplicated and we will be introducing a setting in the parameter store that will determine whether traffic will be send to endpoint A, or endpoint B.
A lambda function is always an option, but I'm looking to see if there's anything already within the managed services side of AWS that can help us. At first ALB seemed a logical choice as that has routing rules, unfortunately it seems the rules can only be determined by attributes of the incoming request, and not a Parameter from the parameter store. So perhaps API gateway could be utilised, but with around a million requests per day, I'm concerned this would be costly and it's also not clear whether I forward traffic based on a setting from the parameter store.

Any thoughts appreciated, thanks!

1 Answers
0

There is not a single AWS Service that will respond to changes in the values of SSM parameters. Usually values of SSM parameters are considered infrastructure. So the values of these parameters usually come from CloudFormation templates (or terraform modules). The purpose of these parameters is often their use as defaults for the parameters in other CloudFormation templates.

That being said: The routing change can be easily modelled as an infrastructure change. If you setup your infrastructure as CloudFormation template to use an SSM parameter (this can be done in 2 ways, input parameter default or a dynamic reference). The internals of the CloudFormation template could arrange the proper routing. Deploying the template would use the value of the parameter, but if the parameter changes you need to redeploy the template (making sure you will use the latest value of the SSM parameter).

This could be automated if you set up an EventBridge rule to listen for changes to the parameter in question. The rule could then trigger a lambda. The lambda could then take care of redeploying the unchanged template.

Documentation can be found here:

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/dynamic-references.html

answered a month 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