So far, we've defined the API and its resource, but these changes are not in production until we create a deployment. To enable the API in production, we should deploy it.
If you have read the CloudFormation documentation, you might have seen the AWS::ApiGateway::Deployment resource. It creates an API Gateway deployment perfectly. However, it has a caveat; it creates an immutable resource, so in order to redeploy the latest changes whenever you update the CloudFormation stack, you must add a new Deployment resource. We do not know why such a bad design decision has been taken, but obviously, this resource does not meet our automation needs.
To overcome this issue, we will leverage a very nice feature of CloudFormation: Lambda ...