I have a Lambda function called by S3 put events, which, in turn, must process objects and write to the database on RDS. I want to test things in my intermediate stack, which means that I have a separate bucket, another database endpoint in RDS, and separate IAM roles.
I know how to manually configure the event source of lambda functions and IAM material (in the console), and I read about aliases and versions of lambda, but I do not see support for providing operational parameters (for example, the name of the destination database) based on aliases. Therefore, when I make changes to the function, right now it seems to me that I need a separate copy of the function for setting and production, and I would have to synchronize them manually. All the logic in the code will be the same, and while I get the source bucket and key as a function parameter when I call it, I have no way to transfer the destination data.
For information about the destination database, I could have a switch statement in the body of the function that checks the original S3 bucket and makes a decision, but I hate getting every function to keep this mapping internally. However, this would not work for database credentials or IAM policies.
I believe that I could automate all or most of this using the SDK. Has anyone asked something similar for continuous deployment in the style of integration with Lambda, or is there an easier way to do this that I missed?
source
share