+++ title = "Define the HitCounter API" weight = 100 +++ ## Create a new file for our hit counter construct Create a new file under `cdk_workshop` called `hitcounter.py` with the following content: ```python from constructs import Construct from aws_cdk import ( aws_lambda as _lambda, ) class HitCounter(Construct): def __init__(self, scope: Construct, id: str, downstream: _lambda.IFunction, **kwargs): super().__init__(scope, id, **kwargs) # TODO ``` Save the file. ## What's going on here? * We declared a new construct class called `HitCounter`. * As usual, constructor arguments are `scope`, `id` and `kwargs`, and we propagate them to the `cdk.Construct` base class. * The `HitCounter` class also takes one explicit keyword parameter `downstream` of type `lambda.IFunction`. This is where we are going to "plug in" the Lambda function we created in the previous chapter so it can be hit-counted. ---- Next, are are going to write the handler code of our hit counter.