Create a new file under
hitcounter.py with the following content:
from aws_cdk import ( aws_lambda as _lambda, core ) class HitCounter(core.Construct): def __init__(self, scope: core.Construct, id: str, downstream: _lambda.IFunction, **kwargs): super().__init__(scope, id, **kwargs) # TODO
Save the file.
kwargs, and we propagate them to the
HitCounterclass also takes one explicit keyword parameter
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.