When updating a lambda with a DynamoDB Streams event source I got a mapping already exists error
Error
1 | 10:54:08 AM | CREATE_FAILED | AWS::Lambda::EventSourceMapping | * |
Resolution
Check if your CDK Metadata path has changed. Changing the stack or construct logical ID will change the metadata path.
If the logical ID change was intentional, manually delete the mapping and redeploy.
More Info
When the path changes CDK attempts to replace the mapping. Since CloudFormation must create a new resource before deleting the old, this threw a mapping already exists error.
In my case, I changed the stack logical ID, which triggered a replacement on the event source mapping.