You can use API Gateway tags to control discovery by the Amplify Agents as described here.
While Amplify provides for flexible, robust, and granular control, in this introductory example, we’ll rely on the presence of a tag to control whether or not an AWS API Gateway API is discovered or not. This is referred to as Filter based on tag name. The same principles apply to other Gateways.
The AWS discovery agent environment variable is AWS_FILTER as described here. The tag I’ll use is SHOULD_DISCOVER. For my example, I don’t need a value as we’ll simply check to see if the tag exists. As such, only AWS APIs that you want to be discovered should have this tag set.
Setting up the API Tags
For example, my AWS API Gateway API’s are shown below:
I only want PetStore and ZooStore API’s to be discovered so I will set tags on these two APIs:
but not the third as follows:
Discovery Agent Environment File
Add the following line to your da_env_vars.env file:
AWS_FILTER=tag.SHOULD_DISCOVER.Exists() == true
Run your discovery agent and you will see that only the APIs with the SHOULD_DISCOVER tag (‘PetStore’ and ‘ZooStore’ but NOT ‘AWS HW API’) will be discovered as shown below:
In this post, we looked at using Gateway tags to control discovery. We looked at a simple example, Filter based on tag name. In future blog posts, we’ll look at other ways to leverage tags for discovery.
Learn more about API Gateways.