The internals of the underlying Lambda function
Lambda function is a code that is triggered by an event. Once run, it receives event
and context
objects and runs internal code that will process these objects.
While the context
is just metadata of the Lambda function's execution and can be used for self-maintenance and graceful shutdown, the event
object contains the payload that we want to focus on.
In the case of CRs, we will need to parse the stack's information, run our logic, and respond to CloudFormation. The response should contain the following fields:
- Status (either success or failed)
- Physical resource ID (since it is custom, we need to come up with our own resource ID)
- Stack ID (the same as from the CR request)
- Request ID (the same as from the CR request)
- Logical resource ID (the same as from the CR request)
- Data (may or may not be unnecessary, used for the intrinsic
Fn::GetAtt
function) - After processing and running provisioning...